Skip to main content

Module mcp_schema_opt

Module mcp_schema_opt 

Source
Expand description

MCP tool-schema compression and budget enforcement.

Structs§

OptimizedSchemas
Result of schema optimization.
SchemaBudget
Token budget constraints for tool schemas.
SchemaEntry
A single tool schema entry for optimization.

Functions§

budget_for_coverage
Returns schema limits suited to the client’s integration coverage.
compress_description
Collapses whitespace and truncates a description to the requested token budget.
estimate_tokens
Estimates token usage using a conservative four-characters-per-token ratio.
optimize_schemas
Compresses and filters schemas until the supplied budget is met where possible.