Skip to main content
Glama

roslyn:encapsulate_field

Convert a C# field to a property with getter and setter methods to encapsulate data and control access.

Instructions

Convert a field to a property with getter/setter.

USAGE: Position cursor on a field declaration. OUTPUT: Generated property wrapping the field. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to source file
lineYesZero-based line number on the field
columnYesZero-based column number
previewNoPreview mode (default: true)
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. It discloses key behavioral traits: it's a code transformation tool (implied mutation), requires specific positioning, generates output, and uses zero-based coordinates. It doesn't mention error conditions or permissions, but covers essential 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 perfectly structured with four concise sentences, each earning its place: purpose statement, usage instruction, output specification, and critical warning. No wasted words, and the most important information (zero-based coordinates) is appropriately emphasized.

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 refactoring tool with no annotations and no output schema, the description provides good coverage: purpose, usage, output type, and critical coordinate system. It lacks details about error cases or the exact format of generated output, but covers the essential context given the tool's complexity.

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. The description adds minimal value beyond the schema: it implies 'line' and 'column' parameters relate to cursor positioning and mentions zero-based coordinates, but doesn't explain parameter interactions or the 'preview' parameter's effect.

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 ('Convert a field to a property with getter/setter') and resource ('field'), distinguishing it from siblings like 'extract_method' or 'rename_symbol' which perform different code transformations. It precisely defines the tool's function without ambiguity.

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 explicitly states when to use it ('Position cursor on a field declaration') and provides critical exclusions ('Uses ZERO-BASED coordinates (editor line - 1)'), which helps avoid misuse. It doesn't mention alternatives, but the positioning requirement serves as clear usage guidance.

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