Skip to main content

Supported Types

Basic Types

Python TypeJSON SchemaExample
str{"type": "string"}"hello"
int{"type": "integer"}42
float{"type": "number"}3.14
bool{"type": "boolean"}true

Complex Types

Python TypeJSON SchemaExample
list{"type": "array"}[1, 2, 3]
dict{"type": "object"}{"key": "value"}
Optional[T]Same as TNone or value

Tool Type Examples

String Parameter

@tool("Get user by name")
def get_user(self, name: str) -> dict:
    pass

# JSON Schema:
{
  "name": {"type": "string"}
}

Optional Parameter

@tool("Search products")
def search(self, query: str, limit: int = 10) -> dict:
    pass

# JSON Schema:
{
  "query": {"type": "string"},
  "limit": {"type": "integer"}
}
# "limit" not in required array

Return Types

Tools should return dict:
# ✅ Good
return {"result": "success", "data": {...}}

# ❌ Bad
return "success"  # Not a dict