AgentDb.Mcp (agent_db v0.1.0)

Copy Markdown View Source

The MCP tool inventory over the store facade.

Pure mapping: tool names, JSON-RPC envelope handling, and direct in-process invocation live here so they are usable without HTTP. The controller is a thin wrapper that adds authentication (via the :api pipeline) and trace extraction.

Summary

Functions

Invokes a tool by name with a map of arguments directly in-process.

Handles one JSON-RPC request map.

The MCP tool inventory served by tools/list.

Functions

call_tool(name, args \\ %{}, opts \\ [])

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

Invokes a tool by name with a map of arguments directly in-process.

Returns {:ok, data} on success or {:error, reason} on failure, without JSON-RPC encoding, HTTP, or a network round-trip. opts may carry :trace_context propagated to store operations that accept it.

handle_request(arg1, opts)

@spec handle_request(map(), keyword()) :: map()

Handles one JSON-RPC request map.

Returns a response map with jsonrpc: "2.0". opts may carry :trace_context propagated to store operations that accept it.

tools()

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

The MCP tool inventory served by tools/list.