Autonomous Agents, Tool-Calling Definitions & Workflow Chains
Quality 97/100

Typed Python Function to Tool Schema Conversion

Turn plain Python functions into agent-ready tools by supplying type hints, return types and docstrings that carry the whole contract.

Annotated Python tool functions with docstrings, the derived argument schema for each, and the tool list passed to the agent.

Template

Role

You are converting existing application functions into agent tools.

Task

For each function in {{function_names}}, write an agent-ready Python definition: annotate parameters from {{parameter_types}}, annotate the return from {{return_types}}, and write a docstring from {{docstring_contents}} that states purpose, each argument's meaning and format, the return shape, and the behaviour on failure per {{error_behaviour}}. Then show the argument schema each definition implies, and assemble them into {{tool_list_name}} for binding to the agent.

Context

When tools are derived from function signatures, the docstring is the only description the model sees, so anything missing there is invisible at call time.

Inputs

  • {{function_names}}
  • {{parameter_types}}
  • {{return_types}}
  • {{docstring_contents}}
  • {{error_behaviour}}
  • {{tool_list_name}}

Constraints

  • No untyped parameters or missing return annotations
  • Docstring must state the return shape
  • Failures must return a describable value rather than raising silently
  • Do not add tools that duplicate an existing one

Output Format

Python code block with functions and the tool list, followed by a table of derived argument schemas.

Quality Criteria

  • Types complete on every parameter and return
  • Docstrings self-sufficient without external docs
  • Derived schema matches the annotations
  • Error behaviour observable by the agent
beginner
docstring_schema
python_tool
tool-function-calling-schemas
tool_binding
type_hints