Skip to main content
Glama

โšก 10-Second Quickstart

Add Tokenectomy to your coding agent with zero configuration. Works immediately via npx (no Rust toolchain required):

1. Cursor IDE

Add to .cursor/mcp.json in your workspace root (or global ~/.cursor/mcp.json):

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"]
    }
  }
}

2. Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"]
    }
  }
}

3. Or Pipe Directly in Your Terminal

npm test 2>&1 | npx tokenectomy-razor

Related MCP server: uacos

๐Ÿ›‘ The Problem: Why Your AI Hits Rate Limits & Hallucinates

When your app crashes during development (Next.js, Express, FastAPI, Tokio), the runtime dumps hundreds of lines of third-party plumbing from node_modules or site-packages.

When you paste that raw crash dump into Cursor or Claude:

  1. Eats Your 5-Hour Rate Limit: A single Express/Prisma error can dump 5,000 to 45,000 tokens of third-party library code you never wrote. A few crash loops easily burn your session limit.

  2. Triggers AI Hallucinations: Claude gets lost in framework internals (node_modules/express/lib/router/layer.js or starlette/routing.py) and tries to edit library files instead of your actual application code.

  3. Leaks Secrets & Credentials: Connection strings with raw database passwords, JWT bearer tokens, and cloud keys embedded in error traces get forwarded to external model servers.

Raw Terminal Crash (45,820 tokens + Leaked Secrets)
     โ”‚
     โ–ผ  <0.2ms Local Rust DFA Engine
[Redact Passwords & Keys] โ”€โ”€โ–บ [Strip Third-Party Framework Frames] โ”€โ”€โ–บ [Isolate Root Cause]
     โ”‚
     โ–ผ
Clean Context (118 tokens โ€ข Zero Secrets โ€ข Sub-millisecond)

๐Ÿ” Before & After Comparison

โŒ Without Tokenectomy: AI Hallucinates & Burns 45,000 Tokens

TypeError: Cannot read properties of undefined (reading 'digest')
    at Object.<anon> (/node_modules/next/bundle5.js:142:31)
    at __webpack_require__ (/node_modules/next/bundle5.js:198:12)
    at Object.execute (/node_modules/next/dev-server.js:412:19)
    at processTicksAndRejections (task_queues:95:5)
    Database connection failed: postgresql://admin:super_secret_password@db.prod.internal:5432/primary
    API key leaked: sk-ant-api03-abcdef1234567890abcdef1234567890
    [... 480 internal dependency frames flooding your context window ...]

What Claude does: Tries to understand bundle5.js, suggests modifying your webpack bundle or adjusting Next.js internals, and eats a massive chunk of your context window. Leaks your database credentials to external logs.

โœ… With Tokenectomy: Clean Context & Instant Fix

// [Tokenectomy Surgery: 480 framework frames pruned (99.7%)]
// Source: src/components/Header.tsx:42
42 |   const user = useSession( ;
   |                           ^ Expected ')'
๐Ÿ›ก๏ธ [CONNECTION_STRING_REDACTED]
๐Ÿ›ก๏ธ [REDACTED_ANTHROPIC_KEY]

What Claude does: Instantly identifies that line 42 in Header.tsx is missing a closing parenthesis ). Applies the exact 1-line fix in 2 seconds. Credentials redacted before transmission. 99.7% token reduction.


๐Ÿ”ฌ Verifiable Benchmarks

All performance claims are hardware-grounded and independently reproducible on physical hardware (measured on 10-Core Intel Core i5-1235U @ 15W running Arch Linux, Kernel 6.13):

Hardware Dependency Notice: Performance is hardware-dependent; reported throughput represents measured results on the specified test hardware (10-Core Intel Core i5-1235U @ 15W TDP). Throughput scales with higher TDP desktop/server CPUs and faster memory buses. Developers are encouraged to independently audit performance using the reproduction command below.

$ cargo test --release --test stress_benchmark -- --nocapture

=====================================================================================
๐Ÿงช TOKENECTOMY OSS VERIFIABLE HEAVY STRESS BENCHMARK (100% REPRODUCIBLE IN OSS)
   Hardware: 10-Core / 12-Thread Intel Core i5-1235U | OS: Arch Linux | Kernel Telemetry Active
   Initial Baseline Process Memory (VmRSS): 3.45 MB
=====================================================================================

๐Ÿ”ฅ [TEST 1/3] QUARTER-MILLION LINES LOG REDACTION TORTURE (250,000 LINES / 25MB+ BUFFER)
  โ”œโ”€โ”€ Buffer Size: 24.44 MB (250000 lines)
  โ”œโ”€โ”€ Redaction Latency: 471.05ms (51.9 MB/sec)
  โ”œโ”€โ”€ Line Throughput: 530,735 lines/sec
  โ”œโ”€โ”€ Peak Memory (VmRSS): 76.05 MB (Delta: +72.60 MB)
  โ””โ”€โ”€ Status: โœ… PASSED (100% of 250,000 lines sanitized, zero memory balloon)

๐Ÿ”ฅ [TEST 2/3] REDOS CATASTROPHIC BACKTRACKING TORTURE (50,000 CHARS PAYLOAD)
  โ”œโ”€โ”€ Attack Payload Size: 50,082 characters
  โ”œโ”€โ”€ Execution Latency: 1.165 ms
  โ””โ”€โ”€ Status: โœ… PASSED (Linear O(N) evaluation, ReDoS-resistant on tested payloads)

๐Ÿ”ฅ [TEST 3/3] HIGH-CONCURRENCY TORTURE (100 PARALLEL OS THREADS)
  โ”œโ”€โ”€ Thread Concurrency: 100 concurrent OS threads
  โ”œโ”€โ”€ Successful Operations: 100/100 (100.0%)
  โ”œโ”€โ”€ Total Elapsed: 11.31ms
  โ”œโ”€โ”€ Concurrency Throughput: 17,688 ops/sec
  โ”œโ”€โ”€ Final VmRSS: 78.99 MB
  โ””โ”€โ”€ Status: โœ… PASSED (Zero race condition, zero deadlock)

=====================================================================================
๐Ÿ† TOKENECTOMY OSS STRESS BENCHMARK: 3/3 PASSED (100% GREEN)
   Total Suite Duration: 580.83ms
   Bounded Final VmRSS: 78.99 MB
=====================================================================================
test test_oss_heavy_stress_benchmark ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.58s

Benchmark Target

Workload Under Test

Verified Measurement

Result

Log Redaction Throughput

250,000 lines (24.44 MB) enterprise dump with API keys & connection URIs

530,735 lines/sec (471.0 ms, 51.9 MB/s)

Pass

ReDoS Resilience

50,000-character pathological backtracking regex payload

1.16 ms (Deterministic Linear $O(N)$ DFA Evaluation)

Pass

Thread Concurrency

100 concurrent OS threads executing simultaneous redaction

17,688 ops/sec (100/100 completed in 11.31 ms)

Pass

Memory Footprint

Peak Resident Memory during 250k-line continuous stress test

76.05 MB VmRSS via /proc/self/status

Pass

Release Test Suite

Full integration test matrix across extractors, filters, and analyzers

57 / 57 Verified Green (Zero panics, zero leaks)

Pass

๐Ÿ›ก๏ธ Automated Redaction & Secret Sanitization Benchmark

Automated evaluation across 12 polyglot crash traces (Rust, Python, TypeScript, Go, YAML) containing 22 ground-truth credentials and clean negative controls. Evaluated head-to-head against Gitleaks v8.30.1.

1. Per-Category Precision, Recall & F1-Score

Secret Category

Ground Truth

Razor Recall

Razor F1

Gitleaks Recall

Gitleaks F1

Sanitization Advantage

Anthropic Claude API Key (sk-ant-...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

AWS Access Key ID (AKIA...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

AWS Secret Access Key

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

Database URI (PostgreSQL, MySQL, Redis, Mongo)

4

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

Generic Passwords / Auth Secrets (YAML/JSON)

3

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

GitHub Personal Access Token (ghp_...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

GitLab Personal Access Token (glpat-...)

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

HuggingFace API Token (hf_...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

JSON Web Token (RFC 7519 / Truncated)

2

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

npm Registry Access Token (npm_...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

OpenAI API Key (sk-..., sk-proj-...)

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

PEM Private RSA Key Block

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

PyPI Package Upload Token (pypi-AgEI...)

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

SendGrid API Key (SG...)

1

100.0%

100.0%

0.0%

0.0%

+100% Recall (M2M zero-leak)

Slack Bot/User Token (xoxb-...)

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

Stripe Live/Test Secret Key (sk_live_...)

1

100.0%

100.0%

100.0%

100.0%

Parity (100% caught)

2. Head-to-Head Performance & Architectural Summary

Dimension

Tokenectomy Razor (--scrub)

Gitleaks v8.30.1

Architectural Rationale

Overall Secret Recall

100.0% (22/22)

36.4% (8/22)

Razor captures unquoted URIs, DB ports & AI keys missed by diff rules

Overall Precision

100.0% (0 False Positives)

88.9%

Zero false triggers on compiler errors & minified traces

Overall F1-Score

100.0%

51.6%

Comprehensive coverage engineered specifically for crash context

Execution Engine

Zero-allocation Rust DFA ($O(N)$)

Go regex scanner + Git tree crawler

Sub-millisecond latency for agent streaming backtraces

ReDoS Resilience

Deterministic Linear Time ($O(N)$)

Engine dependent

Non-backtracking DFA regex prevents catastrophic backtracking on tested dumps

Sanitization Action

Inline token redaction ([KEY_REDACTED])

Warning log only (No scrub)

Directly sanitizes text before ingestion by LLM cortex

3. Token Reduction & LLM Context Savings (tiktoken cl100k_base)

Metric

Measured Value

Operational Impact for AI Coding Agents

Mean Token Reduction

41.67%

Consistently shrinks raw crash trace token footprint

Median Reduction (P50)

42.95%

Typical credential and connection dump reduction

90th Percentile (P90)

61.42%

Eliminates long multi-line keys and credentials

Min / Max Spread

0.00% โ€” 81.36%

0% on clean negative controls (zero distortion), up to 81.4% on leaks

Total Tokens Preserved / Saved

920 tokens (44.02% net)

Prevents context window saturation and reduces LLM billing


๐Ÿš€ Quick Start

1. Model Context Protocol (MCP) Setup

Tokenectomy Razor operates natively over JSON-RPC 2.0 stdio, compliant with the official Model Context Protocol specification.

Cursor Composer

Add to .cursor/mcp.json in your workspace root:

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"]
    }
  }
}

Windsurf (Codeium)

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"]
    }
  }
}

VS Code (Cline / Roo Code)

In Cline or Roo Code settings (cline_mcp_settings.json):

{
  "mcpServers": {
    "tokenectomy": {
      "command": "npx",
      "args": ["-y", "tokenectomy-razor", "--mcp"],
      "disabled": false,
      "autoApprove": ["get_error_context", "analyze_code"]
    }
  }
}

Google Antigravity CLI

agy mcp add tokenectomy-razor -- npx -y tokenectomy-razor --mcp

2. Standalone CLI & Terminal Piping

When debugging or piping terminal output directly:

# Pipe terminal test failures through the surgical redactor:
npm test 2>&1 | razor --scrub

# Sanitize a specific raw log file:
razor --scrub --file /var/log/app/error.log > sanitized.log

# Offline local air-gapped mode (zero external network calls):
cat failure.log | razor --scrub --local-only

3. AI Gateway Reverse Proxy (--proxy)

Tokenectomy Razor can operate as a high-throughput local HTTP reverse proxy on 127.0.0.1:8080. It intercepts outbound prompt streams, performs real-time token excision and credential sanitization, and forwards clean requests upstream to OpenAI, Anthropic, or Ollama.

# Start local gateway proxy forwarding to OpenAI:
razor --proxy --proxy-bind 127.0.0.1:8080 --upstream-url https://api.openai.com/v1

# Start local gateway forwarding to Ollama:
razor --proxy --proxy-bind 127.0.0.1:8080 --upstream-url http://127.0.0.1:11434/v1

Point any standard SDK client to the local proxy:

export OPENAI_BASE_URL="http://127.0.0.1:8080/v1"

FinOps Economics Dashboard

Open http://127.0.0.1:8080/dashboard in any browser to monitor real-time token savings, dollar savings (blended LLM pricing), total requests, and active security redactions.


๐Ÿ› ๏ธ Exposed MCP Tools

Tokenectomy Razor complies with Glama Grade A Tool Definition Quality Score (TDQS) with explicit parameter boundaries:

Tool Name

Capability Description

get_error_context

Performs trace surgery on error dumps, removes framework noise, redacts credentials, and extracts relevant local source context bounded to the workspace.

analyze_code

Performs static AST code analysis to detect resource leaks, unclosed handles, and syntax vulnerabilities with bounded execution limits and precise LSP UTF-16 coordinates.

apply_code_patch

Applies atomic file modifications with post-write language syntax verification (cargo check, py_compile, node --check) and automated rollback on failure.

search_stack_overflow

Queries Stack Exchange API for relevant error signatures using sanitized, redacted search terms.

audit_context_health

Audits raw logs, traces, or prompt payloads for token bloat, framework noise, and credentials. Returns M2M telemetry, savings metrics, and context health grades.


๐ŸŒ Supported Polyglot Ecosystems

Language

Frameworks Supported

Excluded Framework Internals

Rust

Tokio, Actix-web, Axum

.cargo/registry, .rustup, target/debug/build

TypeScript / JS

Next.js, Express, NestJS, Vite

node_modules, .next, dist, webpack internals

Python

Django, FastAPI, Flask, PyTorch

site-packages, dist-packages, venv, __pycache__

Golang

Gin, Fiber, Stdlib Panics

go/src (stdlib), go/pkg/mod, vendor

Java / Kotlin

Spring Boot 3, Tomcat, Netty

.m2/repository, .gradle/caches, internal bytecode

C / C++

AddressSanitizer, GDB / LLDB

/usr/include, /usr/lib, vcpkg_installed

C# (.NET)

ASP.NET Core, .NET Runtime

System.Private.CoreLib, Microsoft.AspNetCore

Ruby on Rails

Rails, Sinatra, Bundler

/gems/, ruby/gems, internal rack handlers

PHP

Laravel, Symfony

vendor/composer, vendor/symfony


๐Ÿ“ฆ Installation Options

Method 1: Instant via npx (Zero Toolchain Setup)

npx -y tokenectomy-razor --mcp

Method 2: Cargo (crates.io)

cargo install tokenectomy

Method 3: Precompiled Standalone Binaries

Zero-dependency, standalone release binaries available on GitHub Releases:

  • Linux: x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl, aarch64-unknown-linux-gnu

  • macOS: aarch64-apple-darwin (Apple Silicon M1/M2/M3/M4), x86_64-apple-darwin (Intel)

  • Windows: x86_64-pc-windows-msvc.exe

Method 4: Multi-Arch Docker Container (GHCR)

docker pull ghcr.io/tokenectomy-labs/razor:latest
docker run -i ghcr.io/tokenectomy-labs/razor:latest --mcp

โš–๏ธ Edition Comparison

Capability

Razor (Community OSS)

Sentinel (Commercial Tier)

Polyglot Stack Trace Surgery

Yes (4 Languages)

Yes (All 7 Languages)

O(N) ReDoS-Safe Secret Redaction

Yes

Yes

JSON-RPC 2.0 MCP Server

Yes

Yes

AI Gateway Reverse Proxy (--proxy)

Yes

Yes

SHA-256 Idempotency Cache (24h TTL)

Yes

Yes

FinOps Metrics Dashboard

Yes

Yes

Tree-sitter AST Syntax Healing

โ€”

Yes

Anti-Hallucination Scope Guard

โ€”

Yes

Automated Test Rollback (0 Dirty Diff)

โ€”

Yes

Multi-File Atomic Transactions

โ€”

Yes

Time Machine Undo Engine (--undo)

โ€”

Yes

Autonomous Healing State Machine

โ€”

Yes

Need Enterprise AST Self-Healing? Explore the Sentinel Tier


๐Ÿ—บ๏ธ Roadmap & Milestones

Milestone / Capability

Status

Target

Core Polyglot Log Surgery & $O(N)$ ReDoS Redaction

โœ… Complete

v1.0.0

AI Gateway Reverse Proxy (--proxy) & Idempotency Cache

โœ… Complete

v1.1.0

Multi-arch Docker & GitHub Actions Marketplace Action

โœ… Complete

v1.1.3

Static AST Analysis Engine (analyze_code) & UTF-16 LSP

โœ… Complete

v1.1.5

Glama.ai Tool Definition Quality Score (TDQS Grade A)

โœ… Complete

v1.1.5

Precompiled Standalone Binaries (Linux, macOS, Windows)

โœ… Complete

v1.1.6

Official MCP Registry Listing (io.github.Tokenectomy-Labs/razor)

โœ… Complete

v1.1.7

mcpservers.org Directory Listing

โœ… Complete

v1.1.7

Java/Kotlin (Spring Boot 3) & C/C++ (ASan) Extractors

โœ… Complete

v1.2.0

C# (.NET) & Ruby on Rails Deep Stack Surgery

โœ… Complete

v1.2.2

User-defined custom redaction & noise rules (~/.tokenectomy.toml)

โœ… Complete

v1.2.2

Autonomous Context Health Audit (audit_context_health) & M2M Advisory

โœ… Complete

v1.2.2

Automated Redaction Benchmark & CI Gate

โœ… Complete

v1.2.2

Declarative Advisory M2M Control Plane ([:TOKENECTOMY:M2M_CONTROL_PLANE:v1.3.0])

โœ… Complete

v1.3.0

Interactive Multi-Strategy Budgeting (aggressive, conservative, lossless_compact)

โœ… Complete

v1.2.3

GitHub Actions OIDC Official Registry Publishing Gate

โœ… Complete

v1.2.3

awesome-mcp-servers Community Catalog Listing

โœ… Complete

v1.2.4

Inline Dropped Frame Identities ([DROPPED_FRAMES: ...]) & Anti-Silent Truncation Audit

โœ… Complete

v1.3.1

Content-Addressable Raw Log Cache & Verification Hash (--diff-verify)

โœ… Complete

v1.3.1

Native VS Code & JetBrains companion extensions

๐Ÿ“‹ Planned

v1.4.0

Server-Sent Events (SSE) remote MCP transport

๐Ÿ“‹ Planned

v1.4.0


๐Ÿ”’ Security & Invariants

  • Zero-Knowledge Architecture: All parsing, filtering, and secret redaction execute on physical local hardware. No logs are ever transmitted to third-party telemetry servers.

  • Deterministic Linear-Time Pattern Matching: All pattern matchers utilize finite automaton evaluation (Rust non-backtracking DFA regex engine and Aho-Corasick) providing deterministic $O(N)$ linear time guarantees on tested adversarial inputs.

  • Path Traversal Boundary Isolation: File operations are strictly locked within the active workspace root (CWD). Path traversals (../) and unauthorized symlinks are blocked.

  • Safe Rust Implementation: Core execution paths enforce safe Rust memory guarantees with bounded stream readers (.take()) preventing resource exhaustion.

For vulnerability disclosures, please review our Security Policy.


Tokenectomy Razor is provided strictly for lawful developer productivity, observability, log surgery, and defensive credential redaction. Any downstream forks, clones, redistributions, or private deployments operate completely independently of the original authors. Tokenectomy Labs and its maintainers assume zero liability for unlawful, malicious, or unauthorized actions committed by third parties using this codebase or derivatives thereof. All downstream operators bear 100% individual responsibility for compliance with local and international cybersecurity laws. See DISCLAIMER.md for full legal terms.


๐Ÿค Community & Resources


Available Tools

5 tools
analyze_codeA

Performs static AST code analysis using Tree-sitter to detect resource leaks (such as unclosed file handles), security vulnerabilities, and logic flaws with bounded execution limits and precise LSP UTF-16 coordinates.

โ€ข Side Effects: None. Strictly read-only analysis of in-memory code; does not execute code, spawn subprocesses, or write to disk. โ€ข Auth & Permissions: None required. Fully offline, in-memory parser. โ€ข Rate Limits: None. Bounded to 1MB max source size, 128 max AST depth, and 50,000 max node visits per call. โ€ข Return Shape: Returns a JSON object containing 'language', 'findings_count', 'duration_ms' (latency metric), and 'findings' (array of objects with rule_id, message, severity, line [1-indexed], column [1-indexed UTF-16 code units], and remediation). โ€ข Failure Modes: Returns findings: [] if the code contains no detected defects. Returns an error message if the language is unsupported or if source code exceeds the 1MB or 128 AST depth limits. โ€ข When to use: Use proactively before committing or running code, or when reviewing Python files for unclosed file handles, resource leaks, or AST defects. โ€ข When NOT to use: Do NOT use when you have an active runtime crash log (use get_error_context instead), and do NOT use to apply fixes automatically (use apply_code_patch instead). โ€ข Prerequisites: Supported languages currently include Python ('python', 'py').

ParametersJSON Schema
NameRequiredDescriptionDefault
codeYesRaw source code string to analyze. Must not exceed 1,000,000 bytes (1MB). Does not execute runtime code; strictly parsed via Tree-sitter AST.
languageYesProgramming language identifier for the code snippet. Case-insensitive. Supported values: 'python', 'py'.

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description fully discloses side effects (None, read-only), auth requirements (None required, offline), rate limits (1MB, 128 depth, 50k node visits), return shape (JSON with language, findings_count, duration_ms, findings array), and failure modes (empty findings, error on unsupported language or exceeded limits). This is comprehensive and leaves nothing ambiguous.

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?

The description is long but tightly organized in bullet points with clear headers. Every sentence adds value: side effects, auth, rate limits, return shape, failure modes, when/when-not, and prerequisites are all addressed. It front-loads the core purpose and then details specifics without redundancy.

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?

This is a complex tool (static analysis, multiple detection categories, limits, error conditions) with no annotations or output schema. The description fully compensates by specifying the exact return structure, failure modes, prerequisites (supported languages), and constraints. An agent has everything needed to call it 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?

The input schema already offers 100% description coverage for both parameters, including constraints (size limit, case-insensitivity, supported values). The description adds little new meaning for parameters beyond what the schema provides; it reiterates the 1MB limit but that's behavioral context rather than parameter semantics. Baseline 3 applies because the schema does the heavy lifting.

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 explicitly states the verb 'Performs static AST code analysis using Tree-sitter' and the resource 'code', and specifies the exact detection categories (resource leaks, security vulnerabilities, logic flaws). It names alternatives in the 'When NOT to use' section (get_error_context, apply_code_patch), distinguishing this tool from siblings clearly.

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?

Provides a dedicated 'When to use' section recommending proactive use before commits or for Python file review, and a 'When NOT to use' section explicitly naming two sibling tools (get_error_context and apply_code_patch) with conditions for each. This is explicit routing guidance.

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

apply_code_patchA

Applies an atomic, verified code edit to a specific file by substituting original_code with new_code, with automatic syntax validation and instant rollback on failure.

โ€ข Side Effects: Modifies the target file on the local filesystem. If syntax checks pass, the file is overwritten with patched contents; if syntax validation fails, the file is immediately restored to its exact original state (zero dirty diff). โ€ข Auth & Permissions: Requires write permissions for the target file on the host filesystem within the workspace boundary. Path traversal outside workspace root is blocked. โ€ข Rate Limits: None. Local disk I/O. โ€ข Return Shape: Returns a JSON object with 'status' ('success' or 'error'), 'file_path', 'lines_changed', 'verification' ('passed' or 'reverted'), and 'message'. โ€ข Failure Modes: Fails and aborts without touching the file if file_path is not found, if original_code does not match the file content uniquely, or if the compiler/linter check fails after patch application. โ€ข When to use: Use when you have finalized a bug fix or refactoring snippet and need safe, transactional application with zero risk of syntax corruption. โ€ข When NOT to use: Do NOT use for speculative edits without prior diagnosis (use get_error_context first), and do NOT use for whole-file generation when only a small block changes. โ€ข Prerequisites: Target file must exist and be within the current workspace directory.

ParametersJSON Schema
NameRequiredDescriptionDefault
dry_runNoOptional. When true, validates that the patch matches uniquely and checks syntax without writing any changes to disk. Defaults to false.
new_codeYesThe replacement code block to substitute in place of original_code. Must maintain correct language syntax and indentation matching the surrounding code.
file_pathYesTarget file path to modify. Can be relative to the workspace root or an absolute path located inside the workspace boundary. Path traversal outside the workspace is rejected.
original_codeYesThe exact character-for-character contiguous code block to be replaced, including exact leading indentation, newlines, and whitespace. Must match exactly one location in the file.

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and covers it comprehensively: side effects, permissions, rate limits, return shape, rollback behavior, and failure modes. It explicitly states that the file is overwritten on success, restored on failure, and that path traversal is blocked. This is far beyond the typical threshold.

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 well-structured with clear sections (side effects, auth, rate limits, return shape, failure modes, usage, prerequisites) and front-loads the core function. It is slightly redundantโ€”syntax validation and rollback are stated both in the opening sentence and in side effects/failure modesโ€”but every section otherwise earns its place.

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?

For a mutation tool with 4 parameters, no annotations, and no output schema, the description is complete: it explains side effects, permissions, rate limits, return shape, failure modes, prerequisites, and when to use it. Nothing an agent needs to invoke this tool safely and correctly is missing. The return shape section compensates for the absent output schema.

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 baseline is 3, and the description does not add parameter-specific detail beyond the schema. It repeats some constraints already in the schema (exact match, syntax/indentation), so the description adds no meaningful new parameter semantics, but the schema itself is already rich.

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 opens with a specific verb ('Applies') tied to a resource ('atomic, verified code edit to a specific file') and a clear mechanism (substituting original_code with new_code). It also names distinct behaviors like automatic syntax validation and rollback, which separates it from siblings focused on analysis or context retrieval.

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?

The description includes explicit 'When to use' and 'When NOT to use' sections, with conditions and an alternative ('use get_error_context first'). It clearly states when the tool is appropriate (finalized fix needing safe transactional application) and when it is not (speculative edits, whole-file generation), leaving no ambiguity.

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

audit_context_healthA

Audits a raw error log, code snippet, or prompt payload for token bloat, framework noise, and credential leaks. Returns actionable M2M telemetry and savings recommendations without mutating workspace state.

โ€ข Side Effects: None. Read-only in-memory evaluation. โ€ข Auth & Permissions: None. โ€ข Rate Limits: None. โ€ข Return Shape: Returns JSON with 'raw_characters', 'estimated_raw_tokens', 'clean_characters', 'estimated_clean_tokens', 'tokens_saved', 'noise_reduction_pct', 'secrets_detected', 'health_grade' ('OPTIMAL', 'MODERATE_BLOAT', 'CRITICAL_BLOAT'), and 'recommendation'. โ€ข When to use: Call proactively when dealing with large terminal dumps or before sending long logs to the LLM to verify context efficiency. โ€ข When NOT to use: Do NOT use to apply file edits (use apply_code_patch) or query stack overflow.

ParametersJSON Schema
NameRequiredDescriptionDefault
payloadYesRaw string, stack trace, or prompt payload to audit for token bloat and credentials.

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden. It explicitly states side effects are none, it is read-only in-memory evaluation, requires no auth, has no rate limits, and details the exact return shape including fields and possible health grade values.

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?

The description is structured with bullet points and front-loads the core purpose. Each section adds distinct value: side effects, auth, rate limits, return shape, when to use, and when not to use. Nothing feels redundant.

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?

Given one parameter, no output schema, and no annotations, the description fully compensates: it explains input expectations, return format, safety profile, and usage boundaries. An agent has everything needed to select and invoke the tool 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 coverage is 100% and the parameter description already explains that payload is a raw string, stack trace, or prompt payload. The tool description adds mild extra context about error logs and code snippets but does not fundamentally expand parameter semantics beyond the schema.

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 audits raw error logs, code snippets, or prompt payloads for token bloat, framework noise, and credential leaks. It differentiates itself from siblings by explicitly saying it does not apply file edits or query Stack Overflow.

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?

Provides explicit when-to-use guidance: proactively for large terminal dumps or before sending long logs to an LLM. It also gives clear when-not-to-use guidance, naming apply_code_patch and search_stack_overflow as alternatives.

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

get_error_contextA

Extracts focused source code snippets and git diffs from a raw error log or stack trace, stripping framework noise (node_modules, site-packages) and redacting credentials.

โ€ข Side Effects: None. Strictly read-only; does not modify workspace files, git state, or environment variables. โ€ข Auth & Permissions: None required. Reads local filesystem within the current workspace boundary. โ€ข Rate Limits: None. Runs entirely locally on native machine code. โ€ข Return Shape: Returns a JSON object with 'sanitized_trace' (string without secrets/noise), 'source_frames' (array of objects with file, line, code_snippet), and 'git_diff' (string or null). โ€ข Failure Modes: If source files referenced in the trace do not exist locally, omits code snippets for those frames while still returning the sanitized trace. Returns an error JSON on unreadable input. โ€ข When to use: Call immediately when receiving a runtime exception, test failure, or compiler error to isolate the root cause before planning code fixes. โ€ข When NOT to use: Do NOT use to search web solutions (use search_stack_overflow), do NOT use to modify files (use apply_code_patch), and do NOT use to statically lint clean code without an error log (use analyze_code). โ€ข Prerequisites: Workspace directory must be accessible locally; git repository recommended for diff extraction.

ParametersJSON Schema
NameRequiredDescriptionDefault
logYesRaw error stack trace, compiler panic, or terminal stderr string to analyze (e.g. Python traceback, Node.js error, Rust panic). Must be non-empty UTF-8 text up to 1MB. Automatically sanitized of API keys, JWTs, and passwords.
strategyNoContext pruning and token budgeting strategy. Options: 'aggressive' (default: excises all framework internals and idle threads), 'conservative' (retains boundary transition frames), or 'lossless_compact' (preserves all frames, compressing only whitespace and redacting credentials).
context_linesNoNumber of source code lines to retrieve above and below each detected error line. Integer between 0 and 100. Defaults to 10 lines. Larger values expand the context window but consume more LLM tokens.

TDQS

A4.7/5.0
Behavior5/5

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

With zero annotations provided, the description carries the full burden and discharges it completely: it declares no side effects (read-only, no workspace/git/env mutation), no auth required, no rate limits (local execution), the JSON return shape with field-level detail, and concrete failure modes (missing source files โ†’ omitted snippets with sanitized trace still returned; unreadable input โ†’ error JSON). It also lists prerequisites. Nothing about actual behavior is left to inference.

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?

The definition is long but every bullet earns its place: purpose sentence up front, then tightly grouped bullets for side effects, auth, rate limits, return shape, failure modes, usage routing, and prerequisites. Since annotations and output schema are both absent, this length is justified rather than padded โ€” each section answers a distinct question an agent would have before invoking.

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?

Despite having no annotations and no output schema, the description covers every category an agent needs: purpose, when/when-not with alternatives, behavioral safety profile, exact return structure (including nullable git_diff), failure modes, and prerequisites. A tool with 3 parameters, one enum, and nuanced output is fully specified for correct invocation with no unresolved questions.

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 per the rubric the baseline is 3. The schema's own descriptions are thorough โ€” log includes format/size/sanitization semantics, strategy explains each enum value with its default, and context_lines gives range, default, and token tradeoff. The description's Return Shape section adds light contextual interplay (strategy affects output) but doesn't need to compensate for any schema gap.

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?

Opens with a specific verb-and-resource statement: 'Extracts focused source code snippets and git diffs from a raw error log or stack trace.' The scope is precise (error logs/traces only, noise stripped, credentials redacted), and the 'When NOT to use' section names each sibling tool with its distinct purpose, so an agent can unambiguously tell this apart from search_stack_overflow, apply_code_patch, and analyze_code.

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?

Explicit 'When to use' states the exact trigger conditions: 'Call immediately when receiving a runtime exception, test failure, or compiler error.' The 'When NOT to use' section gives exclusion criteria AND names the correct alternative for each (web search โ†’ search_stack_overflow, file modification โ†’ apply_code_patch, linting clean code โ†’ analyze_code). This is the gold standard for routing guidance.

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

search_stack_overflowA

Queries the public Stack Overflow / Stack Exchange API for verified programming solutions and discussions matching an error signature.

โ€ข Side Effects: None. Strictly read-only network search; does not mutate local files or repository state. โ€ข Auth & Permissions: No API key required for standard rate-limited anonymous queries. โ€ข Rate Limits: Subject to public Stack Exchange API rate limits (~300 requests/day per IP). Results are cached locally when possible. โ€ข Return Shape: Returns a JSON object containing 'query', 'total_results', and 'results' (array of objects with title, url, score, is_answered, answer_count, and answer excerpt). โ€ข Failure Modes: Returns empty results array if no matching questions exist. Returns an error message if network connectivity fails or API quota is exhausted. โ€ข When to use: Use when local code context from get_error_context is insufficient and external community patterns, known library bugs, or API migration examples are needed. โ€ข When NOT to use: Do NOT use with raw un-sanitized logs containing private tokens or file paths, do NOT use for local codebase inspection (use get_error_context), and do NOT use to edit code (use apply_code_patch). โ€ข Prerequisites: Outbound HTTP internet access to api.stackexchange.com.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesTargeted search query string (e.g. 'ValueError: unsupported operand type(s) for +: int and str'). Must be free of project-specific paths, private tokens, or proprietary variable names. 3 to 150 characters recommended.

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and covers side effects (strictly read-only), auth requirements (no API key), rate limits, return shape, and failure modes. This is precisely the behavioral context an agent needs before invoking an external network 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?

The description is front-loaded with the core purpose and then organized into clearly labeled bullet sections. Every bullet conveys necessary operational guidance, and there is no filler or redundant restatement of the tool name.

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?

Given that there is no output schema and the tool depends on external network behavior, the description fully covers return shape, failure modes, rate limits, and prerequisites. An agent has all the information needed to decide whether and how to call this tool safely and correctly.

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

Parameters4/5

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

The schema already documents the query parameter at 100% coverage, so the baseline is 3. The description adds valuable semantics beyond the schema by advising that the query must be free of project-specific paths/tokens and recommending a 3-150 character length, which helps the agent formulate a valid and safe query.

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 states a specific verb and resource: 'Queries the public Stack Overflow / Stack Exchange API' for solutions matching an error signature. It also differentiates from siblings by referencing local context tools and code-editing tools, so an agent can clearly tell what this tool is for.

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?

The description includes explicit 'When to use' and 'When NOT to use' sections naming sibling tools get_error_context and apply_code_patch as alternatives. It specifies the conditions under which this tool is preferred and when it must be avoided, leaving no room for inference.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.1.8
    • Addedanalyze_code
    • Changedapply_code_patch4 fields changed
      • addedInput schema / properties / dry_run
        Added value: +{
        +  "description": "Optional. When true, validates that the patch matches uniquely and checks syntax without writing any changes to disk. Defaults to false.",
        +  "type": "boolean"
        +}
      • changedInput schema / properties / file_path / description
        Previous value: -"Absolute path to the file"New value: +"Target file path to modify. Can be relative to the workspace root or an absolute path located inside the workspace boundary. Path traversal outside the workspace is rejected."
      • changedInput schema / properties / new_code / description
        Previous value: -"The new code block"New value: +"The replacement code block to substitute in place of original_code. Must maintain correct language syntax and indentation matching the surrounding code."
      • changedInput schema / properties / original_code / description
        Previous value: -"The exact code block to be replaced"New value: +"The exact character-for-character contiguous code block to be replaced, including exact leading indentation, newlines, and whitespace. Must match exactly one location in the file."
    • Addedaudit_context_health
    • Changedget_error_context3 fields changed
      • addedInput schema / properties / context_lines / description
        Added value: +"Number of source code lines to retrieve above and below each detected error line. Integer between 0 and 100. Defaults to 10 lines. Larger values expand the context window but consume more LLM tokens."
      • addedInput schema / properties / log / description
        Added value: +"Raw error stack trace, compiler panic, or terminal stderr string to analyze (e.g. Python traceback, Node.js error, Rust panic). Must be non-empty UTF-8 text up to 1MB. Automatically sanitized of API keys, JWTs, and passwords."
      • addedInput schema / properties / strategy
        Added value: +{
        +  "description": "Context pruning and token budgeting strategy. Options: 'aggressive' (default: excises all framework internals and idle threads), 'conservative' (retains boundary transition frames), or 'lossless_compact' (preserves all frames, compressing only whitespace and redacting credentials).",
        +  "enum": [
        +    "aggressive",
        +    "conservative",
        +    "lossless_compact"
        +  ],
        +  "type": "string"
        +}
    • Changedsearch_stack_overflow1 field changed
      • addedInput schema / properties / query / description
        Added value: +"Targeted search query string (e.g. 'ValueError: unsupported operand type(s) for +: int and str'). Must be free of project-specific paths, private tokens, or proprietary variable names. 3 to 150 characters recommended."
  2. 3 tool updatesv0.1.0
    • First observedapply_code_patch
    • First observedget_error_context
    • First observedsearch_stack_overflow

TDQS

A4.4/5.0

Scored across 5 tools

Disambiguation2/5

get_error_context and audit_context_health overlap heavily: both consume raw error logs, strip framework noise, and detect credentials, differing mainly in output metrics vs. source extraction. The other tools are distinct, but these two create real ambiguity about which to call for a given error log.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern: get_error_context, search_stack_overflow, apply_code_patch, analyze_code, audit_context_health. The verbs clearly describe the action and the nouns identify the target.

Tool Count5/5

Five tools is well-scoped for an error-diagnosis-and-patching workflow. Each tool serves a distinct stage (extract context, search external knowledge, analyze statically, apply patch, audit token health) without redundant or excessive surface area.

Completeness3/5

The core flow from error context to search to analysis to patching is present, but there is no tool to verify behavior after a patch or revert a syntactically valid but logically incorrect change. Additionally, audit_context_health reports token savings but does not return a cleaned/trimmed payload, leaving a notable gap for a context-optimization-focused server.

Maintenance

ActivityMaintained
ResponsivenessResponsive

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A lightning-fast, language-agnostic code analysis MCP (Model Context Protocol) server built in Rust
    9
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Local-first code intelligence and safety layer for AI coding agents. MCP server exposes dependency graph, impact analysis, and AST-compressed repo context, backed by typed local memory, patch-scope safety gates, and git-independent transaction rollback.
    1
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Local MCP server that lets your AI coding agent query its own cross-tool project history - file/command freshness, past test failures, cost & token spend, cache status, and session handoff - over stdio, 100% local, no telemetry.
    46
    -