Skip to main content
Glama

prune_file

Read-onlyIdempotent

Extract semantic interfaces, types, and signatures from a source file while replacing procedural bodies with AST stubs, enabling contract-only inspection without raw implementation or disk changes.

Instructions

Extract semantic interfaces, types, pydantic models, sanitized raises, and signatures from a source file while replacing procedural bodies with AST stubs. Use this when you only need to inspect contracts or APIs of an individual dependency without ingesting raw implementation code. Does not modify files on disk (pure in-memory AST operation).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the source file
depthNoPruning depth: 'full', 'interface', or 'nominal'interface
languageNoProgramming language (python, typescript, javascript, go, java)python
strip_docsNoWhether to strip docstrings entirely

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesSemantic interface stubs extracted via in-memory Tree-Sitter AST
isErrorYesTrue if pruning encountered a fatal parsing or file resolution failure

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.5.6
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "content": {
      +      "description": "Semantic interface stubs extracted via in-memory Tree-Sitter AST",
      +      "items": {
      +        "properties": {
      +          "text": {
      +            "description": "Pruned source code with AST stubs",
      +            "type": "string"
      +          },
      +          "type": {
      +            "enum": [
      +              "text"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "text"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "isError": {
      +      "description": "True if pruning encountered a fatal parsing or file resolution failure",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "content",
      +    "isError"
      +  ],
      +  "type": "object"
      +}
  2. First observedv3.5.0

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true. The description adds the crucial detail that it is a 'pure in-memory AST operation' and does not modify files, which reinforces the read-only nature. It also explains the stubbing behavior ('replacing procedural bodies with AST stubs'), a behavioral trait not captured by annotations. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences: the first states what it does, the second gives a usage condition, and the third clarifies safety. It is front-loaded with the core behavior and has no filler. It could be slightly tightened ('pure in-memory AST operation' is mentioned both implicitly and explicitly) but remains efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description does not need to document return values. The tool has moderate complexity (4 parameters) but the schema covers them all. The description covers purpose, usage, and safety assumptions. Missing are potential edge cases (e.g., unsupported language, invalid path), but these are not essential for basic selection and invocation. A 4 reflects sufficiency without exhaustive detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so every parameter (path, depth, language, strip_docs) has a descriptive comment. The description does not add additional parameter-specific meaning beyond the schema, but the baseline for high coverage is 3. It neither improves nor detracts from the schema, so a 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: extracting semantic interfaces, types, models, raises, and signatures while stubbing bodies. It names specific output artifacts and contrasts with 'ingesting raw implementation code,' making its purpose precise. The sibling tools (resolve_context_bundle, evaluate_spec_axioms) are distinct enough that no further differentiation is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use this when you only need to inspect contracts or APIs of an individual dependency without ingesting raw implementation code.' This gives a clear condition for use. It does not explicitly name alternatives or say when not to use it, but the context is sufficient for an agent to decide. A 4 reflects the strong 'when' but lack of explicit 'when-not' or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.