Skip to main content
Glama

sharphy_patch_il

Modify CIL bytecode by replacing opcodes, adjusting branch targets, and writing a patched binary to alter execution flow, bypass validation, or insert NOP sleds.

Instructions

Surgically modifies CIL bytecode instructions by replacing target opcodes, adjusting branch targets, and emitting a patched binary. Use this tool when bypassing validation logic, inserting NOP sleds, or altering execution flow. Do NOT use for general obfuscation stripping (use 'sharphy_clean_obfuscation'). Mutates by writing a patched assembly to outputPath.

Input Schema

NameRequiredDescriptionDefault
typeNameYesFully qualified class name
newOpCodeYesNew CIL OpCode (e.g., Nop, Ldc_I4_1, Ret)
methodNameYesTarget method name
outputPathYesDestination path for the patched binary
assemblyPathYesPath to the target assembly
instructionOffsetYesIL offset of the instruction to replace

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

No annotations, so the description carries the full behavioral burden. It usefully discloses that it mutates by writing a patched assembly to outputPath (implying original preserved), but doesn't mention permissions, error handling for invalid offsets, or side effects on the source assembly. Partial disclosure for a mutation 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?

Three tight sentences, front-loaded with the core action, then usage, then exclusion. Every sentence earns its place with 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 6-required-param mutation tool with no annotations and no output schema, the description covers purpose and destination well but leaves error behavior and precise return value undocumented. Adequate but with clear gaps.

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%, so the schema already documents all six parameters. The description adds context by naming the mutation concepts (opcodes, branch targets, outputPath) but no syntax or format detail beyond the schema. Baseline 3 appropriate.

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+resource: modifies CIL bytecode by replacing opcodes, adjusting branch targets, emitting a patched binary. Explicitly distinguishes from the sibling 'sharphy_clean_obfuscation' as the non-target for this tool.

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?

Names concrete use cases (bypassing validation, inserting NOP sleds, altering execution flow) and an explicit exclusion routing to the alternative 'sharphy_clean_obfuscation'. When/when-not/alternative are all present.

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