prune_code_context
Prune source code to retain only signatures, types, interfaces, and docstrings, replacing function bodies with stubs to cut token usage and latency for LLM context.
Instructions
Reads a source file or directory (or raw string) and returns an AST-pruned version containing only signatures, types, interfaces, and docstrings. Replaces function/method bodies with stubs to drastically cut token consumption and latency. Python pruning is free; TypeScript/JavaScript pruning is a Pro feature.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Pruning depth: 'interfaces_only' (preserves docstrings) or 'minimal' (strips docstrings) | |
| language | No | Optional language hint ('python', 'typescript', or 'javascript'). Auto-detected if target_path has an extension. | |
| license_key | No | Optional ContextCut Pro license key (can also be set via CONTEXTCUT_LICENSE_KEY environment variable) | |
| target_path | No | Path to the source file or directory to prune (absolute or relative to current workspace) | |
| code_content | No | Optional raw code string to prune directly in-memory instead of reading from disk | |
| glob_pattern | No | Glob filter for directory scans (default: '*.py' for Python, '*.ts' for TypeScript) |