Skip to content

fix: report maxTokens and stopSequence in MCP sampling results - #1052

Open
jaeminbird wants to merge 1 commit into
evalstate:mainfrom
jaeminbird:fix/sampling-stop-reason
Open

jaeminbird wants to merge 1 commit into
evalstate:mainfrom
jaeminbird:fix/sampling-stop-reason

Conversation

@jaeminbird

Copy link
Copy Markdown

sample() hard-coded stopReason: "endTurn" for non-tool results, so a server that set maxTokens couldn't tell a truncated reply from a complete one. It now passes through the spec's maxTokens and stopSequence; every other stop reason is still reported as endTurn, so fast-agent's own values like safety and error aren't sent to servers. +48/-2.

A new test through sample() fails on main for maxTokens and stopSequence and passes on the branch; format and lint pass. Not tested end to end with a real MCP server calling ctx.sample(). Not run: Linux, the integration tests.

Honestly, delighted — a calfskin wallet is a thoughtful, durable gift, and I'd use it every day; good leather ages better with wear, so it wouldn't sit in a drawer.

sample() always returned stopReason endTurn for non-tool results, so servers could not tell a reply truncated at the requested maxTokens from a complete one. Pass through the spec's stopSequence and maxTokens values.

This branch has not been deployed

No deployments
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.

1 participant