chunk-your-tools 1.0.1

MCP tool schema decomposition and recomposition
Documentation

Chunk Your Tools

Decompose and recompose MCP tool definition JSON schemas. Split large tool inputSchema trees into addressable chunks (tools, optional properties, enums), then rebuild pruned tool definitions from survivor lists.

This library is extracted from clear-your-tools and contains only decomposition/recomposition — no BM25, proxy, or agent integration.

Install

Channel Package Import
Rust crate chunk-your-tools chunk_your_tools
PyPI chunk-your-tools chunk_your_tools
npm chunk-your-tools chunk-your-tools
Go github.com/qdrddr/chunk-your-tools/sdk/go chunkyourtools
C libchunk_your_tools chunk_your_tools.h
cargo add chunk-your-tools
pip install chunk-your-tools
npm install chunk-your-tools

CLI:

cargo install chunk-your-tools

CLI

Decompose

chunk-your-tools decompose --input tools.json --output ./catalog

Writes decomposed JSON/Markdown chunks under ./catalog/schemas/decomposed/.

Recompose (in-memory)

chunk-your-tools recompose \
  --input tools.json \
  --survivors survivors.json \
  --output recomposed-tools.json

No catalog directory is required — decomposition runs in memory.

Survivors format (semantic names)

{
  "tools": ["mcp__github__create_issue", "Agent"],
  "properties": {
    "Agent": ["model", "optional_field"],
    "mcp__github__create_issue": ["title"]
  },
  "enums": ["opus", "haiku", "Bash"]
}
  • tools: tool IDs/names to keep (omitted tools are dropped)
  • properties: per-tool optional property names (required properties always survive; use dotted paths for nested optionals, e.g. "config.timeout")
  • enums: enum value names to keep

Legacy {json, md} chunk lists (with file_path) are also accepted for integration with clear-your-tools pruners.

Library (Rust)

use chunk_your_tools::{
    NamedSurvivors, PolicyContext, build_catalog_from_tools, recompose_tools_from_names,
};
use serde_json::json;

let tools = vec![/* MCP tool definitions */];
let survivors = NamedSurvivors::from_value(&json!({
    "tools": ["Agent"],
    "properties": { "Agent": ["model"] },
    "enums": ["opus"]
})).unwrap();
let ctx = PolicyContext::new();
let recomposed = recompose_tools_from_names(&tools, &survivors, &ctx);

SDKs

SDK Path Docs
Python sdk/python README
TypeScript sdk/typescript README
Go sdk/go README
C sdk/c README

Development

See DEV.md and run ./scripts/local-dev.sh all for the full monorepo check.

License

Apache-2.0