# How to audit MCP tool calls

DevFeed: [How to audit MCP tool calls](<https://devfeed.tech/articles/how-to-audit-mcp-tool-calls-104671.md>)

Original publisher: [Read original article](<https://nirmata.com/2026/10/26/how-to-audit-mcp-tool-calls/>)

Author: Ritesh Patel

Published: 2026-10-26T15:00:00Z

Content type: tutorial

Language: en

Sources: [Nirmata](<https://devfeed.tech/sources/nirmata.md>)

Topics: [audit](<https://devfeed.tech/topics/audit.md>), [API Logging](<https://devfeed.tech/topics/api-logging.md>), [OpenTelemetry](<https://devfeed.tech/topics/opentelemetry.md>), [hooks](<https://devfeed.tech/topics/hooks.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [ai-governance](<https://devfeed.tech/tags/ai-governance.md>), [argument](<https://devfeed.tech/tags/argument.md>), [arguments](<https://devfeed.tech/tags/arguments.md>), [audit](<https://devfeed.tech/tags/audit.md>), [audit-trail](<https://devfeed.tech/tags/audit-trail.md>), [chmod](<https://devfeed.tech/tags/chmod.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [cli](<https://devfeed.tech/tags/cli.md>), [collector](<https://devfeed.tech/tags/collector.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [events](<https://devfeed.tech/tags/events.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [mcp](<https://devfeed.tech/tags/mcp.md>), [mcp-tool](<https://devfeed.tech/tags/mcp-tool.md>), [opentelemetry](<https://devfeed.tech/tags/opentelemetry.md>), [otel](<https://devfeed.tech/tags/otel.md>), [security](<https://devfeed.tech/tags/security.md>), [server](<https://devfeed.tech/tags/server.md>), [source](<https://devfeed.tech/tags/source.md>), [tool](<https://devfeed.tech/tags/tool.md>)

## AI overview

Claude Code's MCP audit relies on OpenTelemetry events plus hooks: enable telemetry and the logs exporter, then set `OTEL_LOG_TOOL_DETAILS=1` to capture server and tool names and arguments. Join each `tool_decision` with its `tool_result` and hook record using `tool_use_id`; rejected calls appear in `tool_decision` but have no result, while failed calls have a result with `success` set to `false`. Hooks add the server's source and, for auto mode denials, a reason. The `mcp_server` hook field requires Claude Code v2.1.274 or later. Event arguments may be truncated, hook logs are locally editable, and arguments or responses may contain sensitive data; the article recommends relying on the collector as the record. Managed settings can lock exporter settings, while repository settings cannot set exporter variables. The article says the setup works without AIControls and makes no claim about what its gateway records.

## Source excerpt

Audit MCP tool calls in Claude Code with OpenTelemetry tool events and OTEL_LOG_TOOL_DETAILS=1, plus hooks that record each server's source and denied calls.