ag-ui-protocol / ag-ui-protocol/ag-ui
[Feature]: @ag-ui/claude-agent-sdk: surface the raw MCP tool name so consumers can distinguish MCP vs built-in calls
- 主要語言
- Python
- 星號
- 15.9k
- 分支
- 1.4k
- 平均合併
- 1 天 17 小時
- 30 天內合併 PR
- 163
描述
### Pre-flight Checklist
- [x] I have searched existing issues and this hasn't been requested yet.
### Problem or Motivation
In `@ag-ui/claude-agent-sdk`, `stripMcpPrefix` removes the `mcp____`
prefix before `TOOL_CALL_START` events are emitted and before assistant-message
tool calls are built, so a built-in `Bash` call and an `mcp____Bash` call
are byte-identical in the event stream and in persisted messages.
The stripping is intentional for frontend display matching (the code comment says
`// Use unprefixed name for frontend matching!`), but it discards information that
downstream consumers need: any test or metric that must know which tool actually
ran cannot distinguish an MCP call from a built-in one.
### Proposed Solution
Keep `toolCallName` / `function.name` as the stripped display name, and
additionally carry the original prefixed name in the existing `metadata` map on
both surfaces — on the `TOOL_CALL_START` event and on the assistant-message tool
call (`metadata.rawName`). Both surfaces already expose a `metadata` field, so no
schema change is required. For built-in tools (no prefix), `metadata.rawName`
equals the display name.
### Alternatives Considered
A typed `toolCallRawName` field on the shared `@ag-ui/core` event schemas would
give first-class typing, but it puts an adapter-specific concept (MCP prefix
stripping) into the vendor-neutral core and would need cross-language / proto
coordination for a low-severity need. Carrying the raw name in the existing
`metadata` map avoids all of that and keeps the change inside this integration.
### Additional Context
A PR is opened alongside this issue.
貢獻指南
評估
這個 Issue 還沒有評估資料。