Skip to main content
Use instrumentServer() when you’re building an MCP server and want to log every incoming tool call without client-side setup.

How it works

The function finds the CallTool / call_tool request handler in the server’s requestHandlers map and wraps it. Every tool invocation is timed, its inputs/outputs captured, and an event emitted with source: "mcp_server".

Setup

See the full instrumentServer API in the TypeScript API reference or Python API reference.