Skip to content

docs: remove the nonexistent toolName field from tool.execution_complete - #2212

Open
examon wants to merge 1 commit into
mainfrom
sdk-bugfix-333
Open

docs: remove the nonexistent toolName field from tool.execution_complete#2212
examon wants to merge 1 commit into
mainfrom
sdk-bugfix-333

Conversation

@examon

@examon examon commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

What

The Node.js extension-authoring docs list a toolName field on the tool.execution_complete session event, in two event-field reference tables and three handler code-comments. That event has no toolName, so a reader who copies the reference row or the comment writes event.data.toolName and gets undefined. Because the snippets are JavaScript, there is no error to notice. toolName is emitted on tool.execution_start, and a completion is correlated to its start by toolCallId.

Fixes #2211

Why it is a bug

The shipped types and the bundled schema both disagree with the docs:

  • ToolExecutionCompleteData has toolCallId, success, result?, error?, model?, interactionId?, ... and no toolName; ToolExecutionStartData has toolName: string.
  • The bundled session-events.schema.json declares ToolExecutionCompleteData with "required": ["toolCallId", "success"] and "additionalProperties": false, without a toolName property, so the field is not part of the event's contract.

The repository's own shared reference already documents the event correctly: docs/features/streaming-events.md lists tool.execution_complete without toolName and describes toolCallId as "Matches the corresponding tool.execution_start". These two Node.js pages were the only place making the claim - no other language binding's documentation does, so this brings them back in line with the shared reference rather than introducing a Node.js-specific rule.

The correct pattern is already shown in nodejs/docs/examples.md, which reads toolName in tool.execution_start handlers, records the toolCallId, and matches the completion event by that id. It also states the rule directly: "Correlate tool.execution_start / tool.execution_complete events by toolCallId". No new guidance is added here.

Change

Remove toolName from the two tool.execution_complete reference rows and the three completion-handler comments. It stays on the tool.execution_start rows. Documentation only - no code, type, schema or public API change.

  • nodejs/docs/agent-author.md: 1 table row + 1 comment
  • nodejs/docs/examples.md: 1 table row + 2 comments

Before / after (reference table):

-| `tool.execution_complete` | `toolCallId`, `toolName`, `success`, `result`, `error` |
+| `tool.execution_complete` | `toolCallId`, `success`, `result`, `error`             |

The table cells are re-padded so the column widths stay byte-identical, keeping the diff to the five changed lines.

Verification

  • Every field still listed on the corrected rows (toolCallId, success, result, error) was checked against both the generated types and the bundled schema; all four exist.
  • Type-level: accessing .toolName on ToolExecutionCompleteData fails with TS2339: Property 'toolName' does not exist on type 'ToolExecutionCompleteData', while the same access on ToolExecutionStartData compiles; a control file using only the fields the corrected docs list compiles cleanly.
  • Runtime: in a real session, the tool.execution_complete payload's own keys were toolCallId, success, result, model, interactionId, turnId, toolTelemetry - hasOwnProperty("toolName") was false, and the toolCallId matched the preceding tool.execution_start.
  • Repository-wide check: no remaining Markdown file associates toolName with tool.execution_complete. The 22 other toolName mentions in these two files are tool.execution_start fields, hook inputs, or tool-invocation metadata, and are unchanged.
  • npm run lint, npm run format:check, npm run typecheck and npm run build pass, and the unit suite is green (363 tests). Note that CI does not otherwise exercise this change: scripts/docs-validation only scans the top-level docs/ directory, so nodejs/docs/** snippets are never extracted or compiled - which is why this survived since the pages were added.

Out of scope

The session.idle row in these same two tables lists backgroundTasks, which also does not match the current IdleData (it carries aborted). That claim additionally appears in docs/features/streaming-events.md, so correcting it touches the shared reference and is a wider change than this one; it is deliberately left alone here.

Likewise, these tables are curated "key data fields" summaries rather than exhaustive field lists, so this PR only removes a field that does not exist - it does not add the ones that are merely omitted.

The Node.js extension-authoring docs listed a `toolName` field on the
`tool.execution_complete` session event, in two event-field reference
tables and three handler code-comments. That event has no `toolName`:
`ToolExecutionCompleteData` declares `required: ["toolCallId","success"]`
with `additionalProperties: false` and no `toolName` property, so reading
`event.data.toolName` in a completion handler is always undefined.
`toolName` is emitted on `tool.execution_start`, and a completion is
correlated to its start by `toolCallId`.

Remove the field from the two `tool.execution_complete` rows and the three
completion-handler comments. It stays on the `tool.execution_start` rows.
The repository's shared event reference in docs/features/streaming-events.md
already documents the event without it.
Copilot AI review requested due to automatic review settings August 2, 2026 07:48
@examon
examon requested a review from a team as a code owner August 2, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Corrects Node.js documentation to match the tool.execution_complete event contract.

Changes:

  • Removes the nonexistent toolName field from two reference tables.
  • Removes invalid event.data.toolName references from three examples.
Show a summary per file
File Description
nodejs/docs/examples.md Corrects event tables and handler comments.
nodejs/docs/agent-author.md Corrects event reference and subscription example.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

SDK Consistency Review ✅

This PR makes documentation-only corrections to nodejs/docs/agent-author.md and nodejs/docs/examples.md, removing the nonexistent toolName field from tool.execution_complete event reference tables and handler comments.

Cross-SDK consistency check: No issues found.

  • The PR description confirms that no other language binding's documentation makes the same incorrect claim
  • The shared reference (docs/features/streaming-events.md) already correctly documents tool.execution_complete without toolName
  • No SDK code, types, schemas, or public APIs are changed — this is purely a documentation correction bringing the Node.js docs in line with the actual event contract

No action needed in other SDK implementations.

Generated by SDK Consistency Review Agent for #2212 · sonnet46 16.3 AIC · ⌖ 5.31 AIC · ⊞ 6.6K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node.js docs: tool.execution_complete is documented with a toolName field it does not have

2 participants