Skip to main content
Glama

prune_file

Read-onlyIdempotent

Extracts semantic interfaces, signatures, types, and sanitized raises from a source file, replacing implementation bodies with stubs so agents can inspect dependency APIs without ingesting raw code.

Instructions

Extract semantic interfaces, types, pydantic models, sanitized raises, and signatures from a source file (path) at a given pruning depth ('full' retains full AST with sanitized raises, 'interface' replaces procedural bodies with ... stubs [default], or 'nominal' retains top-level symbol declarations only) and language ('python' [default], 'typescript', 'javascript', 'go', 'java'), optionally stripping docstrings (strip_docs, default false). Use this when you only need to inspect contracts or APIs of an individual dependency without ingesting raw implementation code; for multi-module dependency graphs, use resolve_context_bundle instead.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "prune_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the source file
depthNoPruning depth: 'full' (complete AST with sanitized raises), 'interface' (signatures, types, and '...' stubs; default), or 'nominal' (top-level symbol names only)interface
languageNoProgramming language (python, typescript, javascript, go, java)python
strip_docsNoWhether to strip docstrings entirely

Output 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 changedv4.2.1
    • changedInput schema / properties / depth / description
      Previous value: -"Pruning depth: 'full', 'interface', or 'nominal'"New value: +"Pruning depth: 'full' (complete AST with sanitized raises), 'interface' (signatures, types, and '...' stubs; default), or 'nominal' (top-level symbol names only)"
  2. 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"
      +}
  3. First observedv3.5.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description still adds value by disclosing what the output actually retains or elides at each depth ('full' keeps sanitized raises, 'interface' replaces bodies with `...` stubs, 'nominal' keeps top-level declarations only). It stops short of noting failure behavior for unreadable or unsupported files, which keeps it off a 5.

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?

It is front-loaded with the verb and resource, then the routing guidance, so an agent hits the decision-relevant content first. The single dense sentence with nested parentheticals is somewhat hard to parse, but no clause is filler — each mode definition earns its place.

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?

An output schema exists, so return values need no explanation, and annotations plus a fully covered schema mean the description only needs to sell the purpose and routing. It does both plus documents every mode. Only minor gaps remain, such as error behavior on unsupported languages or non-existent paths.

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 the schema already documents every parameter including defaults and the depth-mode meanings. The description restates the same depth semantics and the `strip_docs` default rather than adding constraints, edge cases, or interactions (e.g., whether `strip_docs` is ignored at 'nominal' depth). Baseline 3 is appropriate when the schema carries the parameter burden.

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 names a specific verb ('Extract') and precise resource set ('semantic interfaces, types, pydantic models, sanitized raises, and signatures') plus the target ('a source file (`path`)'). It explicitly distinguishes itself from `resolve_context_bundle` for multi-module graphs, so an agent can route between the two without opening either schema.

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

Usage Guidelines5/5

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

It gives an explicit when-to-use condition ('when you only need to inspect contracts or APIs of an individual dependency without ingesting raw implementation code') and names the alternative with its selecting condition ('for multi-module dependency graphs, use `resolve_context_bundle` instead'). Nothing is left to inference.

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