Tensile Docs

Capture MCP tool calls

Wrap an MCP server to capture registered tool invocations as trace events.

If your agent calls tools through the Model Context Protocol, the Tensile SDK can wrap supported MCP servers and record registered tool invocations as trace events. The wrapper captures tool inputs, outputs, latency, and success. It does not currently capture resource reads or prompt calls.

What gets captured

When you wrap a supported MCP server, Tensile captures registered tool invocations:

  • Tool calls — the tool name, its arguments, its result, and whether it succeeded. Each tool call becomes an event in Tensile. Related calls share a session so the trace is grouped rather than flattened.

Wrap a server

Use honeai.mcp.track(server, api_key). Call it after registering tools and before the server starts serving.

import honeai.mcp
from mcp.server.fastmcp import FastMCP

server = FastMCP("inventory-tools")

@server.tool()
def check_stock(sku: str) -> int:
    return lookup_quantity(sku)

@server.tool()
def reserve(sku: str, qty: int) -> str:
    return place_hold(sku, qty)

# One line captures tool calls handled by the server.
honeai.mcp.track(server, api_key="sk_your_key_here")

server.run()

Verify

  1. Call one tool on the wrapped server.
  2. Open Raw Logs in the Tensile dashboard to inspect the captured tool call.
  3. Pulse summarizes tool-call counts, success, latency, and cost when those fields are available.

When to use this versus the Conversations SDK

Use the MCP wrapper when the model reaches your tools through MCP. Use the Conversations SDK when your agent is application code that produces a reply per turn. If both are true, use both: turns and tool calls can link into one event tree, so a conversation and the tools it triggered are visible together.

On this page