Skip to main content
Glama

Diogenes Context Compression, Code Patching & Deterministic Solver MCP

Self-Healing Fuzzy Unified Diff & Search/Replace Code Patcher

apply_fuzzy_code_patch
Read-onlyIdempotent

Applies unified diffs (@@ ... @@) or SEARCH/REPLACE blocks to source code using sliding-window token similarity to resolve drifted line numbers, align indentation, and verify bracket balance. Use when healing and applying a code edit or diff that failed exact line matching due to line-number drift or whitespace differences; for inspecting function signatures, call trees, and cyclomatic complexity without modifying code, use analyze_ast_symbol_graph instead. Read-only call (32 KB, 60 RPM): accepts 'original_code' (with enum defaults), uses '?demo=true' or L402 (75 sats); HTTP 400 if invalid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYesUnified diff hunk or <<<<<<< SEARCH ... ======= ... >>>>>>> REPLACE block to apply.
fuzz_strategyNoLine-matching tolerance and indentation behavior; defaults to 'whitespace_normalized_auto_indent' when omitted.
original_codeYesComplete original source file content before patching.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hunks_totalYesTotal patch hunks parsed from the input patch.
patched_codeYesResulting source code after applying all matched hunks.
hunks_appliedYesNumber of hunks successfully anchored and applied.
syntax_balance_verifiedYesTrue when post-patch {}, (), and [] delimiters remain balanced.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotent/non-destructive, so the safety profile is covered, but the description adds real operational context: 32 KB payload cap, 60 RPM rate limit, '?demo=true' or L402 payment at 75 sats, and HTTP 400 on invalid input. It does restate 'read-only call' which the annotation already provides, but the auth/limit/error disclosure is substantive.

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 with purpose and usage before operational details, and every sentence carries information. The final sentence is dense and run-on (rate limits, payment, status codes crammed together), which slightly hurts readability but not substance.

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 and rich annotations exist, so return values and safety needn't be spelled out, and the description still covers auth, quota, payload size, and failure mode. It is complete enough for correct invocation; only the ambiguous enum attribution leaves a small gap.

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 all three parameters are already documented in the schema, giving a baseline of 3. The description adds little beyond noting enum defaults and mentions original_code, but its phrasing 'accepts original_code (with enum defaults)' is slightly misleading since the enum belongs to fuzz_strategy, not original_code.

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+resource: applying unified diffs (@@ ... @@) or SEARCH/REPLACE blocks, with the specific mechanism (sliding-window token similarity). It also names analyze_ast_symbol_graph as the sibling for the non-mutating inspection case, so an agent can route without opening schemas.

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: 'when healing and applying a code edit or diff that failed exact line matching due to line-number drift or whitespace differences'. It also gives an explicit when-not/alternative: use analyze_ast_symbol_graph for inspecting signatures, call trees, and complexity without modifying code.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources