Azure / Azure/data-api-builder
[Bug]: No MCP tool invocation trace spans
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 372
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 9
Description
MCP tool calls (describe_entities, read_records, create_record, update_record, delete_record, aggregate_records) produce log records but no trace spans. You cannot see MCP tool execution in a trace waterfall or measure individual tool latency via traces.
## Expected
Each MCP tool invocation should produce a span with the tool name and result:
```
Span: MCP tool/call describe_entities
Kind: Server
Duration: 37ms
Attributes:
mcp.tool.name = describe_entities
mcp.session.id = oHJsLuTRTyN3En34uxhxmg
rpc.method = tools/call
```
The code paths already exist — DAB has log instrumentation scopes `Azure.DataApiBuilder.Mcp.BuiltInTools.CreateRecordTool` and `Azure.DataApiBuilder.Mcp.BuiltInTools.ReadRecordsTool`, proving these tool boundaries are identified in code.
## Actual
MCP tool calls appear only as logs, not trace spans. The `ModelContextProtocol.Server.McpServer` scope emits log records for tool execution, but there is no corresponding `Activity` or span created:
```
InstrumentationScope Azure.DataApiBuilder.Mcp.BuiltInTools.ReadRecordsTool
LogRecord #0 (log only, no span)
```
Contributor guide
Research direction
Start by locating the MCP tool boundaries identified by the Azure.DataApiBuilder.Mcp.BuiltInTools.CreateRecordTool and ReadRecordsTool instrumentation scopes, then inspect how ModelContextProtocol.Server.McpServer emits tool-execution logs. Add trace spans for the listed MCP tools with the tool name, session ID, RPC method, server kind, and result, and verify that individual tool latency appears in trace waterfalls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100