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

Aperta
#2,633 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
15.9k
Fork
1.4k
Merge medio
1g 17h
PR unite (30g)
163

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.