Validate Tool Schema Consistency • AI Agent SDK

validate_tool_schema_consistency: Validate a list of tools for schema consistency with OpenAI format.

validate_tool_schema_consistency

Function

</div>

This function is defined in the base module.

Validate a list of tools for schema consistency with OpenAI format.

This function ensures all tools in a list can be properly serialized and have consistent schema structures for use with LLM providers.

Diagram

uses

returns

Agent

Tool: validate_tool_schema_consistency

Result

Signature

python
def validate_tool_schema_consistency(tools: List[Any], return_schemas: bool) -> Any

Parameters

ParamField List[Any]

List of tool objects to validate

ParamField bool

If True, return the list of built schemas instead of just a boolean, so callers can reuse them without rebuilding.

Returns

ResponseField Any

True if all tools are valid and consistent (or the built schemas list when `return_schemas` is True)

Exceptions

ToolValidationError

If validation fails

Uses

  • validate_tool
  • ToolValidationError
  • json.dumps
  • names.add

Used By

Source

View on GitHub

praisonaiagents/tools/base.py at line 530


Related Documentation