# `ExMCP.Protocol.RequestProcessor`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/protocol/request_processor.ex#L1)

Processes JSON-RPC requests for MCP servers.

This module handles:
- Request routing based on method name
- Standard MCP method implementations
- Delegation to custom handlers
- Response building for each method type

## Supported Methods

- `initialize` - Protocol handshake and capability negotiation
- `tools/list` - List available tools
- `tools/call` - Execute a tool
- `resources/list` - List available resources
- `resources/read` - Read a resource
- `prompts/list` - List available prompts
- `prompts/get` - Get a prompt
- `notifications/initialized` - Client initialization complete

# `process_result`

```elixir
@type process_result() ::
  {:response, map(), state()} | {:notification, state()} | {:async, state()}
```

# `request`

```elixir
@type request() :: map()
```

# `state`

```elixir
@type state() :: map()
```

# `process`

```elixir
@spec process(request(), state()) :: process_result()
```

Processes a JSON-RPC request and returns the appropriate response.

Returns:
- `{:response, response_map, new_state}` - Synchronous response
- `{:notification, new_state}` - For notifications (no response needed)
- `{:async, new_state}` - For async operations (response sent separately)

## Examples

    iex> request = %{"method" => "tools/list", "id" => 123}
    iex> RequestProcessor.process(request, state)
    {:response, %{"jsonrpc" => "2.0", "id" => 123, "result" => %{"tools" => []}}, state}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
