Get Sorted Tool Schemas • AI Agent SDK

get_sorted_tool_schemas: Get tool schemas sorted by function name for deterministic ordering.

get_sorted_tool_schemas

Function

</div>

This function is defined in the base module.

Get tool schemas sorted by function name for deterministic ordering.

This ensures tool schemas are always ordered consistently for prompt caching optimization.

Diagram

uses

returns

Agent

Tool: get_sorted_tool_schemas

Result

Signature

python
def get_sorted_tool_schemas(tools: List[Any]) -> List[Dict[str, Any]]

Parameters

ParamField List[Any]

List of tool objects (BaseTool instances, callables, etc.)

Returns

ResponseField List[Dict[str, Any]]

List of tool schemas sorted alphabetically by function name

Exceptions

ToolValidationError

If validation fails

Uses

  • validate_tool_schema_consistency

Source

View on GitHub

praisonaiagents/tools/base.py at line 589


Related Documentation