> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**base**](../modules/base) module.

Get tool schemas sorted by function name for deterministic ordering.

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

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    agent["Agent"] -- "uses" --> tool["Tool: get_sorted_tool_schemas"]
    tool -- "returns" --> result["Result"]
    style tool fill:#189AB4,color:#fff
    style agent fill:#8B0000,color:#fff
    style result fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def get_sorted_tool_schemas(tools: List[Any]) -> List[Dict[str, Any]]
```

## Parameters

<ParamField query="tools" type="List[Any]" required={true}>
  List of tool objects (BaseTool instances, callables, etc.)
</ParamField>

### Returns

<ResponseField name="Returns" type="List[Dict[str, Any]]">
  List of tool schemas sorted alphabetically by function name
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ToolValidationError">
    If validation fails
  </Accordion>
</AccordionGroup>

## Uses

* `validate_tool_schema_consistency`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/tools/base.py#L575">
  `praisonaiagents/tools/base.py` at line 575
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Tools Concept" icon="wrench" href="/docs/docs/concepts/tools" />

  <Card title="Create Custom Tools" icon="plus" href="/docs/docs/guides/tools/create-custom-tools" />

  <Card title="Tool Development" icon="code" href="/docs/docs/tutorials/advanced-tool-development" />
</CardGroup>
