Skip to main content
Glama

apply_code_action

Apply a code action (refactoring or fix) to a C# file by its title. Use preview mode to see the diff before writing changes to disk.

Instructions

Apply a code action (refactoring or fix) by its title. Use get_code_actions first to discover available actions. Defaults to preview mode (returns diff without writing files). Set preview=false to apply changes to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lineYesLine number (1-based)
columnYesColumn number (1-based)
endLineNoEnd line for text selection (1-based, optional)
previewNoPreview only — return diff without writing to disk (default: true)
filePathYesFull path to the C# source file
endColumnNoEnd column for text selection (1-based, optional)
actionTitleYesExact title of the code action to apply (from get_code_actions)
Behavior4/5

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

With no annotations, the description carries full burden. It discloses the default preview mode (returns diff without writing) and the effect of setting preview=false (applies changes to disk). This is adequate transparency for a mutation tool, though it could mention reversibility.

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 two concise sentences that convey purpose, prerequisite workflow, and key parameter behavior. No wasted words; front-loaded with the action and resource.

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 7 parameters and no output schema, the description covers the core workflow (discover then apply) and preview behavior. It omits details about return format or error handling, but is sufficient for an agent to invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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 meaningful context beyond the schema by explaining that actionTitle is the exact title from get_code_actions and that preview controls whether changes are written. This extra context justifies a 4.

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 uses specific verbs ('Apply') and resource ('code action refactoring or fix') and immediately distinguishes from the sibling tool 'get_code_actions' by instructing to use it first for discovery.

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 explicitly states to use get_code_actions first and explains the default preview mode and how to disable it. It does not mention when not to use this tool or provide alternatives, but the context is clear.

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/MarcelRoozekrans/roslyn-codelens-mcp'

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