Skip to main content
Glama

sharphy_generate_wrapper

Generates strongly-typed C# wrapper code using .NET 8+ UnsafeAccessor attributes to access private members and fields with zero reflection overhead, writing a .cs file for testing internal APIs.

Instructions

Generates strongly-typed C# wrapper source code utilizing .NET 8+ [UnsafeAccessor] attributes to access private members and fields with zero reflection overhead. Use this tool when testing or accessing inaccessible internal/private APIs. Do NOT use for bytecode modification (use 'sharphy_patch_il'). Mutates disk by writing a new C# (.cs) source file to outputPath.

Input Schema

NameRequiredDescriptionDefault
typeNameYesFully qualified target type name
outputPathYesOutput C# source file path (.cs)
assemblyPathYesPath to the target assembly

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose the key behavioral trait: it mutates disk by writing a .cs file to outputPath, and it documents the .NET 8+ requirement and performance profile. It does not say whether an existing output file is overwritten, whether the target assembly is modified at all (it is not, but that's implied only), or what happens on invalid type names.

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 sentences, each earning its place: capability, positive trigger, exclusion + side effect. The most decision-critical fact (disk mutation) is stated up front rather than buried.

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?

For a non-read-only, no-annotation, no-output-schema tool, the description covers what it produces, where it writes, the framework requirement, and the sibling it replaces. Remaining gap is overwrite/error semantics for outputPath, which an agent would want before invoking blindly.

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. The description only reinforces outputPath as a written .cs file; it adds no format or validity details (e.g. fully qualified name syntax, path restrictions) beyond the schema. Baseline 3 applies.

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 (generates) plus a precisely scoped resource (strongly-typed C# wrapper source using [UnsafeAccessor] with zero reflection), and contrasts itself against the sibling tool sharphy_patch_il. An agent can distinguish it from decompile_method or patch_il without opening any schema.

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?

Gives an explicit positive trigger ('when testing or accessing inaccessible internal/private APIs') and an explicit exclusion with the alternative named ('Do NOT use for bytecode modification (use sharphy_patch_il)'). This is exactly the when/when-not/alternative pattern.

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