> ## 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

Function

> This function is defined in the [**base**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/base.md) 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

**tools** `List[Any]` *required*

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

### Returns

**Returns** `List[Dict[str, Any]]`

List of tool schemas sorted alphabetically by function name

### Exceptions

> [accordion] ToolValidationError
>
> If validation fails

## Uses

* `validate_tool_schema_consistency`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/tools/base.py#L589)
>
> `praisonaiagents/tools/base.py` at line 589

***

## Related Documentation

> [card] [Tools Concept](https://praison.ai/docs/docs/concepts/tools)

> [card] [Create Custom Tools](https://praison.ai/docs/docs/guides/tools/create-custom-tools)

> [card] [Tool Development](https://praison.ai/docs/docs/tutorials/advanced-tool-development)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.