ExMCP.MessageProcessor.Handlers (ex_mcp v0.9.2)

View Source

Unified message handlers for all MCP methods.

This module contains the business logic for handling each MCP method, extracted from the duplicate handler implementations in MessageProcessor. Each handler follows a consistent pattern and can be called from any dispatch mode (direct, genserver, or handler).

Summary

Types

conn()

@type conn() :: ExMCP.MessageProcessor.Conn.t()

handler()

@type handler() :: module() | pid()

mode()

@type mode() :: :direct | :genserver | :handler

Functions

handle_completion_complete(conn, handler, mode, params, id)

@spec handle_completion_complete(conn(), handler(), mode(), map(), any()) :: conn()

Handles completion/complete requests.

handle_custom_method(conn, handler, mode, method, params, id)

@spec handle_custom_method(conn(), handler(), mode(), String.t(), map(), any()) ::
  conn()

Handles custom/unknown method requests.

handle_initialize(conn, handler, mode, params, id, server_info)

@spec handle_initialize(conn(), handler(), mode(), map(), any(), map()) :: conn()

Handles initialize requests.

handle_ping(conn, id)

@spec handle_ping(conn(), any()) :: conn()

Handles ping requests.

handle_prompts_get(conn, handler, mode, params, id)

@spec handle_prompts_get(conn(), handler(), mode(), map(), any()) :: conn()

Handles prompts/get requests.

handle_prompts_list(conn, handler, mode, params, id)

@spec handle_prompts_list(conn(), handler(), mode(), map(), any()) :: conn()

Handles prompts/list requests.

handle_resources_list(conn, handler, mode, params, id)

@spec handle_resources_list(conn(), handler(), mode(), map(), any()) :: conn()

Handles resources/list requests.

handle_resources_read(conn, handler, mode, params, id)

@spec handle_resources_read(conn(), handler(), mode(), map(), any()) :: conn()

Handles resources/read requests.

handle_resources_subscribe(conn, handler, mode, params, id)

@spec handle_resources_subscribe(conn(), handler(), mode(), map(), any()) :: conn()

Handles resources/subscribe requests.

handle_resources_unsubscribe(conn, handler, mode, params, id)

@spec handle_resources_unsubscribe(conn(), handler(), mode(), map(), any()) :: conn()

Handles resources/unsubscribe requests.

handle_tools_call(conn, handler, mode, params, id)

@spec handle_tools_call(conn(), handler(), mode(), map(), any()) :: conn()

Handles tools/call requests.

handle_tools_list(conn, handler, mode, params, id)

@spec handle_tools_list(conn(), handler(), mode(), map(), any()) :: conn()

Handles tools/list requests.