Capture MCP tool calls
Wrap a supported MCP server and inspect recorded tool inputs, outputs and failures.
Watch the workflow: Inspect a recorded tool failure · Authored dummy data
Filter authored requests, inspect one failed tool call and read its recorded timeout. An event failure does not establish a customer outcome.
This video shows the matching app inspection workflow with authored dummy data. It does not execute an SDK example or prove successful delivery from your application. Read the matching command examples separately.
Read the walkthrough transcript
- 00:00 — Filter the loaded requests to Failed. These are authored demo events.
- 00:05 — Inspect one failed tool call. Its identity and latency remain visible.
- 00:10 — Read the recorded timeout. An event failure is separate from a customer outcome.
The SDK registry release is pending. These instructions require a trusted source checkout supplied by your team. They do not install a package from the public registry. Without SDK source access, use the capture API instead.
Source setup
For Python, install the SDK with its optional MCP dependency:
python -m pip install "./sdks/python[mcp]"Use Python 3.12 or later in the consuming application's virtual environment. For TypeScript, build and install the source SDK as shown in TypeScript SDK. Also install the supported MCP server library:
npm install @modelcontextprotocol/sdkConfigure capture
Create a scoped API key in Settings. Set TENSILE_API_KEY in the application environment. The default endpoint is https://api.withtensile.com. Set TENSILE_ENDPOINT to change it, including for an isolated local test. Never put a real key in source code or a recording.
Set TENSILE_ENV=staging, or pass the environment explicitly. The explicit setting wins. Without a stage tag, the app cannot treat the record as production traffic.
Wrap a Python server
import os
from mcp.server.fastmcp import FastMCP
import withtensile
import withtensile.mcp
server = FastMCP("demo-tools")
@server.tool()
def add(a: int, b: int) -> int:
return a + b
withtensile.init(os.environ["TENSILE_API_KEY"], environment="staging")
withtensile.mcp.track(server)The wrapper instruments call_tool on a FastMCP instance. Without the optional dependency, or with an unsupported server, it returns the server unchanged and logs a warning. Calling track again on the same wrapped server does not add a second wrapper.
Wrap a TypeScript server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { init, trackMCP } from "@withtensile/sdk";
init(process.env.TENSILE_API_KEY, { environment: "staging" });
const server = new McpServer({ name: "demo-tools", version: "1.0.0" });
trackMCP(server); // wrap before registering toolsRegister tools with the supported MCP library after wrapping. Tensile wraps the server's tool and registerTool callbacks. Existing tools registered before wrapping are not retroactively instrumented.
Choose recorded payloads
Python accepts disable_input=True and disable_output=True. TypeScript accepts disableInput: true and disableOutput: true. These options omit the corresponding payloads from the captured event; they do not redact other data or change the real tool result.
Both wrappers serialize captured arguments and results as JSON text for the ingestion API. They include the configured stage tag. This does not change the original tool response.
Only tool invocations are captured. Resource reads and prompt calls are outside this wrapper's scope. Tool exceptions retain the original exception, with a failed captured event. A capture failure is distinct from a tool failure.
Inspect a recorded tool call
Open Raw Logs, select the matching stage and tool, then inspect one event's arguments, result and success flag. The video shows this app workflow with authored dummy events. A wrapper setup example does not prove that a tool ran or that the event reached storage.