Skip to main content
Glama

prune_context

Extract a minimal, hallucination-resistant context contract for a function or method, preserving exact type signatures and dependencies while cutting input tokens by over 80%.

Instructions

Extracts a minimal, hallucination-resistant context contract for a given function or method. Reduces input tokens by >80% while preserving exact type signatures and dependencies across project modules.

Args: file_path: Absolute or relative path to the Python source file. target_symbol: Identifier of the function or method (e.g. 'procesar_orden' or 'OrderService.procesar_orden'). format: Desired output format: 'stubs' (default, optimal for code LLMs), 'turtle' (RDF), 'json', or 'nl'. include_body: Whether to include the raw source code body of the target function. project_root: Optional root directory of the project (auto-detected if omitted).

Returns: The compact pruned contract string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNostubs
file_pathYes
include_bodyNo
project_rootNo
target_symbolYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description bears the full burden. It discloses useful behavioral traits (token reduction, signature/dependency preservation, available output formats) but never states that this is a safe read-only extraction with no side effects, nor any performance or filesystem-access limits implied by project_root auto-detection.

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-loaded purpose followed by cleanly scoped Args/Returns sections; each line earns its place. Slightly padded by marketing-flavored wording ('hallucination-resistant', '>80%') that adds tone more than callable information.

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-value detail is unnecessary, and the parameter documentation is thorough for a 5-param, 0%-coverage schema. What's missing is the operational framing — when to use it and confirmation of read-only/no-side-effect behavior — which is meaningful for a tool with no annotations.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate — and it does: every one of the five parameters is explained, including path semantics ('absolute or relative'), symbol syntax with concrete examples ('OrderService.procesar_orden'), the accepted format values ('stubs'/'turtle'/'json'/'nl' — not present as an enum in the schema), and project_root's auto-detection fallback.

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

Purpose4/5

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

States a specific verb+resource: 'Extracts a minimal... context contract for a given function or method,' and quantifies the effect ('>80%' token reduction). The term 'context contract' is jargon, but the following clauses (type signatures, dependencies across modules) make the intent concrete. It does not distinguish itself from the sibling verify_response, though that sibling is clearly unrelated.

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

Usage Guidelines3/5

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

Usage is only implied — the tool is framed as an LLM-oriented context extractor, but there is no statement of when to call it versus reading the file directly, nor any preconditions or exclusions. The format/default guidance partially informs selection but is about output shape, not when-to-use.

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

Deploy Server

Other Tools