docs: remove the nonexistent toolName field from tool.execution_complete - #2212
Open
examon wants to merge 1 commit into
Open
docs: remove the nonexistent toolName field from tool.execution_complete#2212examon wants to merge 1 commit into
examon wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
Pull request overview
Corrects Node.js documentation to match the tool.execution_complete event contract.
Changes:
- Removes the nonexistent
toolNamefield from two reference tables. - Removes invalid
event.data.toolNamereferences 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
Contributor
SDK Consistency Review ✅This PR makes documentation-only corrections to Cross-SDK consistency check: No issues found.
No action needed in other SDK implementations.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Node.js extension-authoring docs list a
toolNamefield on thetool.execution_completesession event, in two event-field reference tables and three handler code-comments. That event has notoolName, so a reader who copies the reference row or the comment writesevent.data.toolNameand getsundefined. Because the snippets are JavaScript, there is no error to notice.toolNameis emitted ontool.execution_start, and a completion is correlated to its start bytoolCallId.Fixes #2211
Why it is a bug
The shipped types and the bundled schema both disagree with the docs:
ToolExecutionCompleteDatahastoolCallId,success,result?,error?,model?,interactionId?, ... and notoolName;ToolExecutionStartDatahastoolName: string.session-events.schema.jsondeclaresToolExecutionCompleteDatawith"required": ["toolCallId", "success"]and"additionalProperties": false, without atoolNameproperty, 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.mdliststool.execution_completewithouttoolNameand describestoolCallIdas "Matches the correspondingtool.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 readstoolNameintool.execution_starthandlers, records thetoolCallId, and matches the completion event by that id. It also states the rule directly: "Correlatetool.execution_start/tool.execution_completeevents bytoolCallId". No new guidance is added here.Change
Remove
toolNamefrom the twotool.execution_completereference rows and the three completion-handler comments. It stays on thetool.execution_startrows. Documentation only - no code, type, schema or public API change.nodejs/docs/agent-author.md: 1 table row + 1 commentnodejs/docs/examples.md: 1 table row + 2 commentsBefore / after (reference table):
The table cells are re-padded so the column widths stay byte-identical, keeping the diff to the five changed lines.
Verification
toolCallId,success,result,error) was checked against both the generated types and the bundled schema; all four exist..toolNameonToolExecutionCompleteDatafails withTS2339: Property 'toolName' does not exist on type 'ToolExecutionCompleteData', while the same access onToolExecutionStartDatacompiles; a control file using only the fields the corrected docs list compiles cleanly.tool.execution_completepayload's own keys weretoolCallId,success,result,model,interactionId,turnId,toolTelemetry-hasOwnProperty("toolName")wasfalse, and thetoolCallIdmatched the precedingtool.execution_start.toolNamewithtool.execution_complete. The 22 othertoolNamementions in these two files aretool.execution_startfields, hook inputs, or tool-invocation metadata, and are unchanged.npm run lint,npm run format:check,npm run typecheckandnpm run buildpass, and the unit suite is green (363 tests). Note that CI does not otherwise exercise this change:scripts/docs-validationonly scans the top-leveldocs/directory, sonodejs/docs/**snippets are never extracted or compiled - which is why this survived since the pages were added.Out of scope
The
session.idlerow in these same two tables listsbackgroundTasks, which also does not match the currentIdleData(it carriesaborted). That claim additionally appears indocs/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.