Skip to main content

How can an AI gateway monitor MCP tool calls?

Summary

  • An AI gateway monitors MCP tool calls by sitting in the call path: agents reach registered MCP servers through it, so every tool call carries a verified identity the gateway can log, limit and inspect.
  • Useful monitoring has four layers: usage metrics (volume, errors, latency), an audit trail of who called which tool, traces of requests and responses, and the policy decisions made before and after each call.
  • On Databricks, Unity Gateway records MCP traffic in the system.ai_gateway.usage system table, logs each invocation as mcpCall in system.access.audit, and can write tool requests, responses and policy decisions to a unified trace table (Beta).
  • Service policies (Beta) can check a tool call before it runs and its result after it returns, then allow it, deny it or pause it for the user's approval.
  • Monitoring only covers traffic that passes through the gateway, so register every MCP server your agents use.

How can an AI gateway monitor MCP tool calls?

An AI gateway monitors MCP tool calls by becoming the only path between agents and the MCP servers they use. When an agent calls a tool, the request reaches the gateway first, under the caller's own identity, so the gateway can record who called which tool, how long it took and whether it failed. A gateway that also evaluates policies can stop a risky call before it executes. Traffic that bypasses the gateway goes unseen, so registration comes first.

Why MCP tool calls need their own monitoring

The Model Context Protocol (MCP) is "an open-source standard for connecting AI applications to external systems" (MCP introduction). Agents discover its tools with tools/list and run them with tools/call. A model call produces text; a tool call can query a database or send a message. Tool traffic is where an agent's decisions become actions, so it's where teams most need a record.
Model logs alone miss this: they show what the model asked for, not what the tool returned.

What to monitor

Signal Question it answers What to capture
Usage metrics Which tools are busy, slow or failing? Call counts, errors and latency per server and tool
Audit trail Who invoked which tool, and when? Caller identity, service, tool, timestamp
Traces What happened in this agent session? Tool request and response, linked to the model calls around them
Policy decisions Was a call allowed, blocked or held, and why? Decision, policy, and the phase it ran in
Rate-limit events Is an agent looping or flooding a server? Throttled calls per user or service
Tool exposure Which tools can each agent see at all? The curated tool list per registered server

Keep these signals in queryable tables so one query can join tool activity with model usage and identity.

How Databricks approaches MCP tool-call monitoring

Databricks puts MCP traffic behind Unity Gateway, the governance layer built on Unity Catalog that governs runtime interactions among models, agents, MCP servers and tools. Unity Gateway is generally available. Some capabilities below are in Beta, as marked.
Register servers so traffic flows through the gateway. Each Databricks-provided MCP is a Unity Catalog securable invoked through Unity Gateway. You can register an external MCP server that supports Streamable HTTP from Unity Gateway > MCPs, pick the tools to expose and share it with your team. Callers need EXECUTE on the MCP plus USE CATALOG and USE SCHEMA on its parents.
Usage metrics. Usage tracking records call and service metadata for MCP requests in system.ai_gateway.usage. Filter on service_type = 'MCP_SERVICE', read tool-level details from mcp_metadata, and use the requester column to see which user or service principal made the call. The built-in usage dashboard has an External MCP Server tab.
Audit. Each MCP request is logged as mcpCall in system.access.audit, covering both listing and calling tools, along with create, update and delete events on the service (observability).
Traces (Beta). The unified trace table captures "every request and response across all Unity Gateway services", MCP services included, as OpenTelemetry spans in a Unity Catalog table you choose. An account admin enables the Enhanced Unity Gateway preview, and a metastore admin sets up the table. Delivery is best-effort, and the docs position the table as a complement to audit logs, which remain the system of record for compliance.
Policies on every call (Beta). Service policies run ON CALL before a tool runs and ON RESULT after it returns. On MCP services they can allow a call, deny it, or ask the user to approve it first. Built-in options include sensitive data detection and jailbreak screening for tool calls and results. Evaluation fails closed: any error during evaluation results in a deny.
Limits and exposure. Rate limits on MCP services apply to tools/call requests in queries per minute, and calls over the limit return HTTP 429. Tool filtering keeps unselected tools out of tools/list, which narrows what an agent can attempt in the first place (govern an MCP).

Use cases

  • Incident review: trace an unexpected action back to the model call that requested it and the identity that ran it.
  • Runaway agents: spot a loop in rising call counts and cap it with a per-user rate limit.

FAQs

Do I need to change my MCP server to monitor it?

No. Monitoring happens at the gateway, so a registered external server keeps running where it is. Agents connect to the MCP URL Unity Gateway provides, https://<workspace-hostname>/ai-gateway/mcp-services/<catalog>.<schema>.<service>.

Can I see the arguments and results of each tool call?

On Databricks, the unified trace table (Beta) stores tool requests and responses as OpenTelemetry spans. The usage table and audit logs hold metadata, not full payloads.

How do I stop a dangerous tool call before it runs?

Attach a service policy that evaluates ON CALL. It can deny the call or, on MCP services, pause it for the user's approval. Service policies are in Beta.

Who can read MCP monitoring data?

By default, querying the system tables requires both account and metastore admin roles.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.