ExMCP.Client.RequestHandler (ex_mcp v0.10.0)

View Source

Request/response processing for ExMCP client.

This module handles all request processing, batch operations, message parsing, and response handling for MCP clients.

Summary

Functions

Handles batch MCP requests.

Handles a batch of responses from the transport.

Handles a notification to be sent to the server.

Handles individual MCP requests.

Handles server-to-client requests by routing them to the appropriate handler callback.

Handles a single response from the transport.

Parses a message from the transport.

Encodes and sends a message via the transport.

Functions

handle_batch_request(requests, from, state)

Handles batch MCP requests.

Processes multiple MCP requests in a single batch operation.

handle_batch_response(responses, state)

Handles a batch of responses from the transport.

handle_cast_notification(method, params, state)

Handles a notification to be sent to the server.

handle_request(method, params, from, state)

Handles individual MCP requests.

Processes a single MCP request and returns the appropriate GenServer response.

handle_server_request(method, params, request_id, state)

Handles server-to-client requests by routing them to the appropriate handler callback.

handle_single_response(other, state)

Handles a single response from the transport.

parse_transport_message(message, state)

Parses a message from the transport.

This function is intended to be called from the client's handle_info/2 callback. It decodes the message and delegates to the appropriate response handler.

send_message(message, state)

Encodes and sends a message via the transport.