Skip to main content
Glama

roslyn:extract_interface

Extract an interface from a C# class or struct to generate interface code for dependency injection and testability. Extracts all public instance members automatically.

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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It reveals the output format ('Generated interface code ready to insert') and a critical implementation detail ('Uses ZERO-BASED coordinates'), but doesn't address potential side effects, error conditions, or what happens if the interface already exists. It provides some behavioral context but leaves gaps.

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 efficiently structured with clear sections (purpose, usage, output, important note), uses bullet-like formatting, and contains zero wasted words. Every sentence provides essential information, making it easy to scan and understand quickly.

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 code generation tool with no annotations and no output schema, the description does well by explaining the output format and including a critical implementation detail about zero-based coordinates. However, it doesn't fully address the complexity of interface extraction - missing details about namespace handling, accessibility modifiers, or what happens with inheritance. It's mostly complete but has minor 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 description coverage is 100%, so the schema already fully documents all 5 parameters. The description adds minimal value beyond the schema - it mentions the interfaceName parameter in the usage example but doesn't provide additional semantic context about parameter interactions or constraints. This meets the baseline for high schema coverage.

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 specific action ('Generate an interface from a class or struct') and resource ('all public instance members'), distinguishing it from siblings like extract_method or extract_variable which handle different code elements. It precisely defines what the tool does.

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?

The description provides clear context for when to use the tool ('Position on class declaration') and mentions use cases ('dependency injection and testability'), but doesn't explicitly state when not to use it or name alternatives among the many sibling tools. The guidance is helpful but not exhaustive.

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