Skip to content

fix(roadmap): tool docstrings garble the answer format #4482

Closed

Description

@dan-petty

Problem Description

pydantic-ai makes the description of each tool from the docstring of the tool function. It uses griffe with the Google docstring style. Three read tools have a Returns: section with a colon in the answer format:

  • callers in src/devops_cli/roadmap/stage/stage_tools.py: "One line for each match, as path:line:content."
  • file_symbols in src/devops_cli/roadmap/stage/stage_tools.py: "One line for each symbol, as line: signature."
  • search_code in src/devops_cli/roadmap/refine/refine_investigation.py (the stage tools get it from InvestigationTools): "One line for each match, as path:line:content."

griffe reads a Google Returns: line as type: description, so it splits the line at the first colon. Each stage and refine request thus shows the model a broken answer format, for example:

<returns>
<type>One line for each match, as `path</type>
<description>line:content`.</description>
</returns>

Reproduction Steps

  1. Make a pydantic-ai agent with the stage tools and a FunctionModel.
  2. Read the description of the callers, search_code and file_symbols tool definitions.
  3. See that the answer format is split between <type> and <description>.

The request capture of the context audit (stage_capture.py, item 3387) shows the three broken descriptions.

Expected vs Actual Behavior

Expected: the description of each read tool holds its answer format unbroken, such as path:line:content.

Actual: the answer format is split at the first colon into a <type> part and a <description> part.

Fix: put the answer format in the summary text of the docstring and remove the Returns: section. Add a test that builds the tool definitions and asserts that each read tool description holds its answer format. Do not change the answer format itself.

Environment Diagnostics

pydantic-ai tool definitions with docstring_format="auto" (griffe, Google style). Found by the context audit (item 1.8), upheld by a skeptic review.

Logs, Traces, or Terminal Output

search_code '<summary>Search the files of the repository for a text, in any case.</summary>\n<returns>\n<type>One line for each match, as `path</type>\n<description>line:content`.</description>\n</returns>'
file_symbols '<summary>List the classes, functions and methods of one source file, with their lines.</summary>\n<returns>\n<type>One line for each symbol, as `line</type>\n<description>signature`.</description>\n</returns>'

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The bug corrupts tool descriptions the model reads, degrading agent quality, but the system still runs.
    • Value: Medium. Correct tool descriptions let the model parse answers reliably, improving every stage and refine request.
    • Effort: Low. The fix moves text between docstring sections and adds one assertion test.
    • Related: refactor(ai): Replace PydanticAgent with pydantic-ai Agent #2489, which asks for a different change. Both concern pydantic-ai tool definitions, but 2489 swaps the agent runtime while this candidate fixes garbled docstring text in those tool definitions.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 11, 2026
  4. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 05:46 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions