roslyn:validate_code
Validate C# code syntax and compilation without saving files. Check AI-generated code against existing project context to catch errors before insertion.
Instructions
Check if code would compile without writing to disk. Use to validate generated code before applying.
USAGE: validate_code(code="public void Foo() {}", contextFilePath="path/to/file.cs") to check with existing usings. OUTPUT: compiles (bool), errors list with line numbers. Essential before inserting AI-generated code.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "roslyn:validate_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | C# code to validate | |
| standalone | No | If true, treat code as complete file (default: false) | |
| contextFilePath | No | Optional: file to use for context (usings, namespace) |