Skip to main content
Glama

roslyn:add_null_checks

Add ArgumentNullException guard clauses to method parameters to prevent null reference errors. Place cursor on a method with reference type parameters to insert the checks.

Instructions

Add ArgumentNullException.ThrowIfNull guard clauses for nullable parameters.

USAGE: Position cursor on a method with reference type parameters. OUTPUT: Generated guard clauses inserted at method start. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to source file
lineYesZero-based line number on the method
columnYesZero-based column number
previewNoPreview mode (default: true)
Behavior4/5

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

No annotations provided, so description carries the full burden. It discloses zero-based coordinates (important) and indicates output is guard clauses inserted at method start. Could mention if existing checks are overwritten, but overall adequate for a simple insertion tool.

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?

Concise at three sentences, structured with USAGE, OUTPUT, IMPORTANT. Every sentence serves a purpose without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Lacks explanation of return value (no output schema). Ambiguous about 'nullable parameters' vs 'reference type parameters'. Missing details on handling parameters with existing checks. For a simple tool, mostly adequate but could be expanded.

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% and already describes parameters as zero-based. The description restates the zero-base hint but adds no new meaning for filePath or preview. Default baseline score of 3 applies because schema does the heavy lifting.

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 tool adds ArgumentNullException.ThrowIfNull guard clauses for nullable parameters. It includes usage instructions and distinguishes from sibling tools that perform other refactorings like change_signature or extract_method.

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?

Usage is clearly described: 'Position cursor on a method with reference type parameters.' It does not explicitly mention when not to use, but the context is sufficient for an AI agent. No sibling tool performs the same function, so alternatives are not needed.

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