Skip to content

Tool return types and docstrings are not used #1146

@Krogager

Description

@Krogager

Initial Checks

  • I confirm that I'm using the latest version of Pydantic AI

Description

I noticed that the return type annotations and docstrings of tools are not actually used by pydantic-ai. I was struggling to make my agent understand the instructions and only now noticed that my agent didn't even see the instructions because (part of it) was placed under the "Returns" section of the docstring.

I was wondering if this was left out intentionally, and if so, what was the reason to do so?
If this is indeed intentional, I think it should be mentioned in the documentation somewhere.

Example Code

Python, Pydantic AI & LLM client version

python 3.12
pydantic==2.10.6
pydantic-ai==0.0.40
pydantic-ai-slim==0.0.40
pydantic-graph==0.0.40
pydantic_core==2.27.2

Metadata

Metadata

Assignees

Labels

Feature requestNew feature requestdocumentationImprovements or additions to documentationhelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions