Skip to content

fix(mcp): name null parts instead of throwing in resultText - #360

Merged
davidmckayv merged 1 commit into
CopilotKit:mainfrom
Ayush7614:fix/mcp-null-part-result
Sep 4, 2026
Merged

davidmckayv merged 1 commit into
CopilotKit:mainfrom
Ayush7614:fix/mcp-null-part-result

Conversation

@Ayush7614

Copy link
Copy Markdown
Contributor

resultText cast each part to an object then read item.type. A null/undefined entry from a vendor MCP server threw TypeError (verified: resultText([null]) throws). Primitives were safe, null was not.

Fix returns [unknown] for non-object parts, consistent with the existing naming-not-dropping policy.

Tests: added null/undefined/number cases to server/tests/mcp-result.test.ts (10 pass). Biome clean.

@davidmckayv davidmckayv 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.

Fixes MCP resultText throwing on a null content part (returns [unknown]). Reviewed diff, validated in composed local build (tests green). CI approved.

@davidmckayv
davidmckayv merged commit a65d2fa into CopilotKit:main Sep 4, 2026
13 checks passed
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.

2 participants