ExMCP.MessageProcessor.Dispatcher (ex_mcp v0.9.2)
View SourceUnified message dispatcher that eliminates duplication between different handler modes.
This module provides a single dispatch mechanism that can handle:
- Direct handler calls (DSL servers)
- GenServer-based handlers
- Handler module calls
All business logic is delegated to the Handlers module, while this module handles routing and response adaptation based on the calling mode.
Summary
Functions
Dispatches a request to the appropriate handler based on the method and mode.
Extracts the request ID from a request map.
Types
@type conn() :: ExMCP.MessageProcessor.Conn.t()
@type mode() :: :direct | :genserver | :handler
Functions
Dispatches a request to the appropriate handler based on the method and mode.
Parameters
conn- The connection struct containing the requesthandler- The handler module or server PIDmode- The dispatch mode (:direct, :genserver, or :handler)server_info- Optional server information
Returns
Returns an updated connection struct with the response set.
Extracts the request ID from a request map.