Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.definable.ai/llms.txt

Use this file to discover all available pages before exploring further.

from definable.tool.decorator import tool

Parameters

ParameterTypeDefaultDescription
namestrfunction nameTool name shown to the model.
descriptionstrfrom docstringTool description.
strictboolFalseStrict parameter validation.
instructionsstrNoneUsage instructions added to system prompt.
add_instructionsboolTrueWhether to add instructions to system prompt.
show_resultboolFalseShow result in streaming output.
stop_after_tool_callboolFalseStop agent loop after this tool.
requires_confirmationboolFalsePause for user confirmation.
requires_user_inputboolFalsePause for user input.
pre_hookCallableNone(tool_name, args) -> None. Runs before execution.
post_hookCallableNone(tool_name, args, result) -> None. Runs after execution.
tool_hooksList[Callable]NoneList of hook functions.
cache_resultsboolFalseCache results for identical arguments.
cache_ttlint3600Cache TTL in seconds.

Supported Parameter Types

TypeJSON Schema
str{"type": "string"}
int{"type": "integer"}
float{"type": "number"}
bool{"type": "boolean"}
List[T]{"type": "array", "items": ...}
Optional[T]Nullable variant
Enum{"type": "string", "enum": [...]}
BaseModel{"type": "object", "properties": ...}

Schema Generation

  • Function name → tool name
  • Docstring first line → tool description
  • Args: section → per-parameter descriptions
  • Type hints → JSON Schema types
  • Default values → optional parameters