ExAthena.Mcp (ExAthena v0.7.1)

Copy Markdown View Source

Facade for MCP (Model Context Protocol) server management.

Read APIs (high-level — requires Supervisor running)

  • list_servers/0 — metadata for every registered MCP server. Disabled servers are not started and therefore do not appear in this list.
  • list_tools/1 — cached tools for a server by name.

Low-level APIs (client-pid based)

Summary

Functions

Call a named tool on a Client process directly.

Return metadata for every running MCP server (i.e. every server registered in the registry). Disabled servers are not started, so they are not included.

Return cached tools for the server registered under name.

List tools from a running Client process directly.

Return [Tool.Spec.t()] for all ready, enabled MCP servers.

Functions

call_tool(client, name, input, timeout \\ 30000)

@spec call_tool(pid(), String.t(), map(), non_neg_integer()) ::
  {:ok, map()} | {:error, term()}

Call a named tool on a Client process directly.

list_servers()

@spec list_servers() :: [map()]

Return metadata for every running MCP server (i.e. every server registered in the registry). Disabled servers are not started, so they are not included.

Each entry is a map with keys :name, :status, :type, :enabled, :tool_count, :error.

list_tools(name)

@spec list_tools(String.t()) :: {:ok, [map()]} | {:error, :not_found | term()}

Return cached tools for the server registered under name.

Returns {:ok, [tool_map]} or {:error, :not_found | %ExAthena.Error{}}.

list_tools(client, timeout)

@spec list_tools(pid(), non_neg_integer()) :: {:ok, [map()]} | {:error, term()}

List tools from a running Client process directly.

Lower-level than list_tools/1 — callers that hold a pid use this.

tool_specs(filter \\ :all)

@spec tool_specs(:all | [String.t()]) :: [ExAthena.Tool.Spec.t()]

Return [Tool.Spec.t()] for all ready, enabled MCP servers.

filter controls which servers contribute specs:

  • :all — all ready+enabled servers
  • [server_name] — only the named servers

When the MCP supervisor is not running, returns [] without raising.