Skip to main content
Glama

prune_file

Read-onlyIdempotent

Extract semantic interfaces, types, models, and signatures from a source file at a chosen depth to inspect APIs without reading raw implementation code.

Instructions

Extract semantic interfaces, types, pydantic models, sanitized raises, and signatures from a source file (path) at a given pruning depth ('full', 'interface', or 'nominal') and language, optionally stripping docstrings (strip_docs), 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. For multi-module dependency graphs, use resolve_context_bundle instead. Does not modify files on disk (pure in-memory AST operation).

Input 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

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.4/5.0
Behavior4/5

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

Annotations already establish readOnly/idempotent/non-destructive, so the safety profile is covered. The description adds real behavioral value beyond that: bodies are replaced with AST stubs while docstrings can be stripped, and it is a pure in-memory operation that does not modify files on disk. It stops short of describing return/error behavior, but the output schema covers returns.

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?

Front-loads the extraction verb and its targets, then usage routing, then the side-effect disclaimer. It is dense but each sentence earns its place; the long opening clause is somewhat loaded but remains readable and purposeful.

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

Completeness5/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 not be explained. The description covers purpose, parameter meaning, usage routing, and the key constraint that nothing is written to disk, which is sufficient for an agent to invoke this correctly.

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 all four parameters and their defaults. The description restates depth values and the effect of strip_docs and language, adding only light semantic framing rather than new syntax or constraints beyond the schema, so baseline 3 applies.

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?

States a precise verb and resource: extract semantic interfaces, types, models, raises, and signatures from a source file, with named scope controls (depth, language, strip_docs). It also names the sibling it is not (resolve_context_bundle) for multi-module graphs, so an agent can distinguish it 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?

Gives explicit when-to-use ('when you only need to inspect contracts or APIs of an individual dependency without ingesting raw implementation code') and an explicit 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.