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

未关闭
#2,633 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。