Skip to main content
Glama

roslyn:apply_code_fix

Apply automated code fixes for C# diagnostics using Roslyn. List available fixes, preview changes, then apply corrections to resolve compiler issues in .NET projects.

Instructions

Apply automated code fix for a diagnostic. WORKFLOW: (1) Call with no fixIndex to list available fixes, (2) Call with fixIndex and preview=true to preview changes, (3) Call with preview=false to apply. IMPORTANT: Uses ZERO-BASED coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to source file
diagnosticIdYesDiagnostic ID (e.g., CS0168, CS1998, CS4012)
lineYesZero-based line number (editor line - 1)
columnYesZero-based column number (editor column - 1)
fixIndexNoIndex of fix to apply (omit to list available fixes). Call without this parameter first to see available fixes.
previewNoPreview mode (default: true). Set to false to apply changes to disk. ALWAYS preview first!
Behavior4/5

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

With no annotations provided, the description carries the full burden and does so effectively by explaining the multi-step workflow (list, preview, apply), the importance of previewing first, and the zero-based coordinate system. It doesn't cover all potential behavioral aspects like error handling or performance, but it provides substantial operational context.

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 highly structured and efficient: it starts with the core purpose, then outlines the workflow in three clear steps, and ends with a critical note. Every sentence serves a specific, necessary function with zero wasted words.

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 the complexity of the multi-step workflow and the absence of both annotations and an output schema, the description does an excellent job of explaining how to use the tool. It could be slightly more complete by mentioning what the output looks like (e.g., list of fixes or preview changes), but it provides strong operational guidance.

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 documents all parameters thoroughly. The description adds value by explaining the workflow implications of parameters (e.g., omitting fixIndex to list fixes, using preview mode), but doesn't provide additional semantic details beyond what's in the schema descriptions.

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 ('Apply automated code fix for a diagnostic') and distinguishes it from siblings by focusing on a diagnostic-based workflow, unlike tools like 'apply_code_action_by_title' or 'get_code_fixes' which handle different aspects of code fixes.

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?

The description provides explicit, step-by-step guidance on when and how to use the tool: call without fixIndex to list fixes, then with fixIndex and preview=true to preview, and finally with preview=false to apply. It also includes an important note about zero-based coordinates, which is crucial for correct usage.

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