Product Benefits Pricing Guides Docs About Contact us Try it out
Performance

PostHog WebMCP Error Tracking

PostHog WebMCP error tracking: posthog-js 1.438.8 captures error types and sanitised messages. Learn what to measure for agent tool calls.

· 3 min read

As browsers start letting AI agents call tools exposed by your website, a new kind of failure appears. The agent asks, your page errors, and no person is there to complain. Without error data, these failures stay invisible.

posthog-js 1.438.8 now captures WebMCP error types and sanitised messages. That gives web teams a first look at how often agent-facing tools fail and why, without exposing sensitive text in the message.

Data Points to Track

  • tool_name: the WebMCP tool that was called
  • error_type: the category of failure captured
  • error_message_sanitised: the cleaned message
  • call_count: total tool calls
  • error_rate: errors divided by calls
  • page_url: where the tool is registered
  • sdk_version: the posthog-js version
  • time_to_error_ms: delay between call and failure
  • browser: to spot support differences

Setup Steps

  1. Upgrade posthog-js to 1.438.8 or later.
  2. List your WebMCP tools and give each a stable, readable name.
  3. Confirm capture by triggering a deliberate failure in a test page.
  4. Check the message in the event to be sure no personal data appears.
  5. Build an insight of error_rate by tool_name.
  6. Alert when a tool’s error rate passes a threshold you choose.
  7. Review weekly alongside your normal front-end error reports.

Actionable Insights

A tool with a high error rate is a broken promise to every agent that tries it. Fix those first, and check whether the error type points to bad input, a missing permission or a page bug.

If errors cluster on one browser, you may have a compatibility gap. If they cluster after a deploy, you have a regression.

Compare tool calls with completed outcomes. Many calls and few outcomes suggest the tool is failing quietly or returning answers agents cannot use.

Common Pitfalls

Do not rely on the sanitised message alone. Pair it with the error type and tool name to find the cause.

Do not mix agent-driven errors with human ones. Tag them so each can be analysed separately.

Why Product Teams Should Care

Agent traffic is an emerging channel. Reliable tools make your product easier for agents to use, and error data is the first step.

Testing Checklist

Register a test tool that always fails, call it from a supporting browser, and confirm the event shows the tool name, the error type and a clean message with no user data.

Example Scenario

A retail site exposes a WebMCP tool that returns stock levels for a product. After a deploy, the tool starts throwing when the product ID contains a space. Human visitors never notice, because the product page still works. Agents calling the tool see failures and move on to a competitor.

With error types and sanitised messages captured, the spike appears within hours as a rise in error_rate for that one tool_name, grouped under a single error type. You can link it to the release, fix the input handling and confirm the rate falls back.

Without this data, the only clue would be a slow decline in agent-driven referrals weeks later, which is hard to connect to a single bug.

Metrics Worth Adding

Add a success rate per tool, and the median time_to_error_ms. Fast errors usually mean validation failures, while slow ones suggest timeouts or dependencies. Together they tell you where to look first.