Skip to main content
Glama

roslyn:extract_interface

Extract a C# interface from a class or struct. Generates interface code for dependency injection and testability by extracting all public instance members.

Instructions

Generate an interface from a class or struct. Extracts all public instance members (methods, properties, events).

USAGE: Position on class declaration, provide interfaceName="IMyService". OUTPUT: Generated interface code ready to insert. Useful for dependency injection and testability. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to source file containing the class
lineYesZero-based line number (editor line - 1)
columnYesZero-based column number (editor column - 1)
interfaceNameYesName for the new interface (e.g., 'IMyService')
includeMemberNamesNoOptional: specific member names to include (omit to include all public members)
Behavior3/5

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

Discloses zero-based coordinate requirement and describes output as generated code ready to insert. However, with no annotations, it does not explicitly state whether the tool is read-only or has side effects, leaving behavioral traits partially inferred.

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?

Extremely concise: three brief sentences covering purpose, usage, output, and an important note. Each sentence adds value with no redundancy.

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?

Given no output schema and 5 parameters with full schema coverage, the description adequately explains purpose, output format, coordinate system, and a use case. The optional includeMemberNames is not elaborated but schema covers it.

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 baseline is 3. The description adds an example for interfaceName and reiterates zero-based coordinates, but does not significantly deepen understanding 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?

Clearly states the tool generates an interface from a class or struct, extracting public instance members. Distinguishes from siblings like extract_method or extract_variable by specifying the output type and context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit usage instructions: position on class declaration and provide interfaceName. Mentions usefulness for dependency injection and testability, giving context. Lacks explicit when-not-to-use or alternative sibling comparisons.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pzalutski-pixel/sharplens-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server