agent-tracking

Guides

How do I track MCP and WebMCP tool calls on my site?

If your pages register tools through navigator.modelContext or document.modelContext, or expose declarative forms with a toolname, the snippet records every registration and every call: name, duration, success or failure, error class and the names of the input keys, never their values.

By · Updated 2026-09-08

Diesen Guide auf Deutsch lesen

Nothing to change in your code

The snippet wraps registerTool and provideContext before your code runs. Register tools as the specification says and they appear in the Tools view. Declarative tools, forms carrying a toolname attribute, are caught on submit.

await navigator.modelContext.registerTool({
  name: "add_to_cart",
  description: "Add a product to the cart by SKU.",
  inputSchema: { type: "object", properties: { sku: { type: "string" }, qty: { type: "integer" } }, required: ["sku"] },
  execute: async ({ sku, qty }) => { /* your code */ },
});

What the Tools view answers

Per tool: calls, success rate, average duration, the top three error messages, whether it is declarative, when it was last seen, and whether it has ever been called. The last one matters most: a tool nobody calls has a description agents do not understand or a schema they cannot fill.

Input keys, never values

The names of the argument keys are recorded so you can see that agents send sku but never qty. The values are not, so nothing a person typed reaches the server.

The manifest

If you publish /.well-known/webmcp, the snippet hashes it once per visit. The dashboard shows when it last changed; on Pro and Agency plans an email goes out when it does, which catches a deploy that silently dropped a tool.

In short

Does it see MCP servers that agents call outside the browser?

No. It sees tools called inside the page through the browser's model context API. A remote MCP server has its own logs; this measures the browser side.

Can I test it without an agent?

Yes. The demo page has two tools and a simulate button; simulated calls are marked and never counted as agents.