Skip to content

Conversation

DouweM
Copy link
Collaborator

@DouweM DouweM commented Apr 29, 2025

Fixes #1614

Also uses a unique identifier for each file returned by a tool call.

Copy link

github-actions bot commented Apr 29, 2025

Docs Preview

commit: 88d59af
Preview URL: https://13dda7e9-pydantic-ai-previews.pydantic.workers.dev

@DouweM DouweM force-pushed the mcp-result branch 2 times, most recently from 80316ec to f542b2d Compare April 29, 2025 21:24
@DouweM
Copy link
Collaborator Author

DouweM commented Apr 29, 2025

The issue suggested the following behavior:

if all parts are text, I think we should return it as concatenated text, perhaps '\n'.join(c.text for c in call.context)

I had a chat about this with @dmontagu and we decided to keep multiple text parts as a list, because this may be meaningful (for example, separate RAGged docs that shouldn't look like one doc) and LLMs should understand the list just fine.

If there's only a single part (text or file), we do unwrap the list.

@DouweM DouweM self-assigned this Apr 29, 2025
@DouweM DouweM requested a review from dmontagu April 30, 2025 16:33
@DouweM DouweM merged commit 5fab108 into main Apr 30, 2025
18 checks passed
@DouweM DouweM deleted the mcp-result branch April 30, 2025 18:14
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.

MCP tools should not return the full CallToolResult
2 participants