Tool Decorator

Reference for the @tool decorator.

The @tool decorator converts a function into a Function that agents can call. Use it bare (@tool) or with the parameters below (@tool(...)).

from agno.tools import tool

Parameters

ParameterTypeDescription
namestrOverride for the function name
titleOptional[str]Human-readable MCP tool title (default: None).
annotationsOptional[Dict[str, Any]]MCP behavior hints such as readOnlyHint (default: None); hints do not enforce permissions.
descriptionstrOverride for the function description
strictboolIf True, enforces strict parameter checking on the function schema
instructionsstrInstructions for using the tool
add_instructionsboolIf True, adds the tool instructions to the system message (default: True)
show_resultboolIf True, shows the result after the function call
stop_after_tool_callboolIf True, the agent will stop after the function call
tool_hookslist[Callable]List of hooks that wrap the function execution
pre_hookCallableHook to run before the function is executed
post_hookCallableHook to run after the function is executed
requires_confirmationboolIf True, requires user confirmation before execution
requires_user_inputboolIf True, requires user input before execution
user_input_fieldslist[str]List of fields that require user input
external_executionboolIf True, the tool will be executed outside of the agent's control
external_execution_silentboolIf True (with external_execution=True), suppresses verbose paused messages
cache_resultsboolIf True, enables caching of function results
cache_dirstrDirectory to store cache files
cache_ttlintTime-to-live for cached results in seconds (default: 3600)

requires_confirmation, requires_user_input, and external_execution are mutually exclusive. Enable at most one for a tool.