Skip to main content
Glama

tokenprune_wasm_trim

Prune TypeScript/JavaScript source code by collapsing method bodies to reduce LLM context token usage by 50%-70%.

Instructions

Prune TypeScript/JavaScript source code to reduce LLM context token usage by 50%-70% by collapsing method bodies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoFilename for context (e.g. service.ts)
sourceCodeYesSource code content to prune

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose real behavior: the transformation collapses method bodies and yields a quantified 50%-70% token reduction. It stops short of warning that the output is a lossy, non-executable representation, that signatures/imports are preserved, or any limitations, which matters for a source-rewriting tool.

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

Conciseness5/5

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

A single tight sentence that front-loads the action and resource and then quantifies the payoff. No filler, no redundancy.

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

Completeness3/5

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

For a simple two-parameter tool this is close to sufficient, but with no output schema the description never states that the return value is the pruned source (or its format), and it omits any caveat about the transform being lossy. Those gaps keep it at a minimum-viable level.

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 both parameters (sourceCode, filename) are already documented in the schema, establishing the baseline of 3. The description adds no syntax, format, or size guidance for either parameter beyond what the schema provides.

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 specific verb (prune), a precise resource (TypeScript/JavaScript source code), and the mechanism (collapsing method bodies). The resource is narrow enough that it is trivially distinguishable from all unrelated siblings such as cidr_shield_lookup or edgarpulse_parse_filing.

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?

The use case is strongly implied by the stated goal (reducing LLM context token usage), so an agent can infer when to reach for it. However, there is no explicit when/when-not guidance, no statement that it only applies to TS/JS, and no caution about alternatives or fidelity trade-offs.

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