Repository navigation
07 Tools Layer and MCP Contract
Farol.Tools serves as the Model Context Protocol (MCP) interface layer. It defines and registers Farol's 23 MCP tools, 7 MCP prompts and 3 skill resources, runs four tools as MCP tasks, validates inputs, manages token budgets, and formats responses into dense, LLM-optimized compact text.
-
Naming: All tool names begin with the prefix
dotnet_(e.g.dotnet_check,dotnet_find_references). - Language: Tool names, parameter descriptions, error messages, and responses are in English.
-
Header Mirroring: Every tool accepts an optional
workspaceparameter that is mirrored into theMcp-Param-Workspaceheader. When a root holds no single solution and the call names a file (path,edited, or apath:linesymbol) but noworkspace, the workspace is the one in use that holds the file, else the solution nearest above it (AC-44). -
Path Standards: Paths in arguments and responses are relative to the root Farol runs in and use forward slashes (
/). An argument may also be relative to the workspace's folder (AC-42); a response path outside the root, underFarol:TrustedPaths, is written in full. -
Tool Annotations:
-
readOnlyHint: true: Tools that do not modify files or execute arbitrary code. -
destructiveHint: true:dotnet_code_actions,dotnet_migration_plananddotnet_convert_projectare annotated destructive because they can write (apply=true,write=true); a preview writes nothing. The four refactoring tools write only withapply=trueand are neither read-only nor destructive.
-
-
Structured Output: Every tool declares an
outputSchemaand returnsstructuredContentbuilt from the same results as its text. Schemas are part of themcp-surface.jsonsnapshot: adding a field is compatible, removing or renaming one needs a new major version.-
openWorldHint: true: Tools that query external feeds (packages,package_api). -
dotnet_buildanddotnet_testare neither read-only nor destructive: they run the build and tests, and are refused under--read-only.
-
-
ArgumentCheck: Wraps every tool and checks the arguments against its input schema before the SDK binds them. A missing required argument, or one the SDK cannot bind (an object where a string goes), is aninvalid_argumenterror that names it. A number written as a string, and null for an optional argument, pass, as the SDK binds them. -
ToolGuard: Runs every tool body and turns aFarolExceptioninto an MCP error whose text is the message plus the hint, so the agent reads what to do next. -
ToolParameters: The parameter conventions shared by every tool (workspace,maxTokens,offset) and theMcp-Param-Workspaceheader name. -
ToolProgress: Turns engine progress messages into MCP progress notifications (for example during long workspace loads).
Every tool also takes workspace; tools that return lists take maxTokens (default 1,500, up to 8,000), and the longest lists take offset for paging.
Reports the status of the loaded solution, lists projects that failed to load, identifies the toolchain in use, and indicates whether the background warmup is complete.
-
Inputs:
-
action(string, optional):status(default: report without waiting, starting a background load if needed),load(wait until loaded),reload(discard and load again). -
workspace(string, optional): Path to solution or project file.
-
-
Output: While a load runs, the status says that the other
dotnet_*tools wait for it, how long the load has run, and how long the last load of that workspace in this server took (AC-45). Load issues include analyzers that could not be copied, taken from another SDK, or built for a newer compiler (AC-46, AC-47). -
Annotations:
readOnlyHint: true
Provides a high-level map of an unfamiliar solution in a single call.
-
Inputs:
-
workspace(string, optional): Target workspace path. -
maxTokens(int, optional): Maximum token budget (default: 1500).
-
- Output: Total project count, languages (C#, VB), formats (SDK-style vs classic), target frameworks, app models (WebForms, MVC, WCF, WPF, WinForms), package management (CPM, packages.config), and the recommended working build command.
-
Annotations:
readOnlyHint: true
Finds symbol declarations across the solution using fast parallel matching.
-
Inputs:
-
query(string, required): Exact name, prefix, substring, or camel-case humps (OrdCalc$\rightarrow$ OrderCalculator). -
kind(string, optional):any(default),type,class,interface,struct,enum,record,delegate,method,property,fieldorevent. -
project(string, optional): Restrict search to a specific project. -
maxTokens(int, optional): Token limit (default: 1500).
-
-
Annotations:
readOnlyHint: true
Inspects a specific symbol's signature, documentation comments, and implementation source.
-
Inputs:
-
symbol(string, required): Symbol name, dotted name, documentation comment ID, orpath:line. -
include(string, optional): comma-separated:signature(always),docs,source; defaultsignature,docs. -
workspace(string, optional): Target workspace path.
-
-
Output: Full signature, XML documentation summary, originating project/package, and source from the workspace, or decompiled with
ICSharpCode.Decompilerfor an external member; an external type returns a skeleton of its member signatures. Ambiguous queries return candidate lists (AC-9). -
Annotations:
readOnlyHint: true
Discovers compiler-accurate references across C#, VB.NET, and markup files.
-
Inputs:
-
symbol(string, required): Symbol to search. -
kinds(string, optional): Filter by reference kinds (call,new,read,write,method group,reference,markup). -
maxTokens(int, optional): Token limit (default: 1500).
-
-
Features: Includes object instantiations (
new), tracks references through implemented interface members or base overrides (AC-37), and indexes markup references (.aspx, .xaml, .svc, .asmx). -
Annotations:
readOnlyHint: true
Navigates type inheritance and interface implementation graphs.
-
Inputs:
-
symbol(string, required): Target type or member. -
direction(string, optional):all(default),base,derived(downwards, including implementations) orimplementations.
-
-
Annotations:
readOnlyHint: true
Generates a recursive tree of callers or callees.
-
Inputs:
-
symbol(string, required): Target method or property. -
direction(string, optional):callers(default) orcallees. -
depth(int, optional): Traversal depth (1 to 3, default: 1).
-
- Output: Formatted tree showing signatures, files, lines and up to 5 call sites (file:line) per node.
-
Annotations:
readOnlyHint: true
Extracts a structural outline of a file or type without function bodies.
-
Inputs:
-
path(string, optional): File path relative to the root, as responses write paths. -
symbol(string, optional): Qualified type name.
-
-
Annotations:
readOnlyHint: true
Evaluates compiler diagnostics introduced by agent edits, suppressing pre-existing legacy warnings.
-
Inputs:
-
scope(string, optional):changed(default),file,project,solution. -
path(string, optional): Source file forscope=file. -
project(string, optional): Project name forscope=project. -
includeExisting(bool, optional): If true, lists pre-existing baseline diagnostics. -
format(string, optional):text(default), orhook: the JSON a Claude CodePostToolUsehook returns: the new errors as a blocking reason, new warnings as added context,{}when the edits are clean, a note while the workspace loads. -
edited(string, optional): For editor hooks: the file just edited, read before checking so the answer never lags the edit. -
analyzers(bool, optional): Also run the projects' analyzers (CA/IDE rules, NuGet analyzers) on the edited files (the file or the project's files withscope=file|project), as the build reports them. Default:Farol:CheckAnalyzers.
-
-
Output: Newly introduced compiler errors and warnings with
file:linelocations and descriptions. For a file that changed while the workspace loaded, all of its errors and warnings are listed as new, with a line saying so (AC-48). -
Annotations:
readOnlyHint: true
Surfaces Visual Studio lightbulb quick-fixes and refactorings.
-
Inputs:
-
path(string, required): File path relative to the root, as responses write paths. -
line(int, required): 1-indexed line number. -
column(int, optional): 1-indexed column number. -
diagnosticId(string, optional): Specific compiler error ID (e.g.CS0246). -
action(string, optional): Action number or title to preview or apply. -
apply(bool, optional): If true, writes changes atomically and runs an immediate check.
-
-
Annotations:
destructiveHint: true(it can write withapply=true; a preview writes nothing)
Each tool previews a unified diff and writes nothing; apply=true writes it atomically (refused under --read-only, and with conflict when a file changed since the preview) and returns a fresh dotnet_check. Details in Phase 2.
-
Inputs:
symbol,newName,renameFile(bool, optional),apply. - Effect: Renames a type, member, parameter or local in every C# and VB file and in WebForms and XAML markup, with the file named after a type. Refuses a name that clashes or would rebind a reference.
-
Inputs:
symbol,parameters(the new list: existing parameters by name in their new order, new ones with a type and the value callers pass; a parameter left out is removed),apply. - Effect: Updates the declaration, overrides, implementations and every call site in C# and VB.
-
Inputs:
symbol,toNamespaceand/ortoFile,apply. -
Effect: Moves a top-level type, adding the
using/Importsits users need and updating classic project files.
-
Inputs:
path,startLine,endLine,name,apply. - Effect: Whole statements into a new method, through Roslyn's extract method, in C# and VB.
-
Inputs:
project,kind(sdk_style|package_reference),apply. -
Effect: Changes the project file's format, not what it builds; with
apply=trueit restores, reloads and compares files, references, packages and errors before and after. -
Annotations:
destructiveHint: true
Builds the workspace or project using the correct toolchain (dotnet build or Visual Studio MSBuild.exe).
-
Inputs:
-
project(string, optional): Project name, asdotnet_overviewlists it. -
configuration(string, optional): Build configuration (default:Debug).
-
- Output: Status, exit code, elapsed duration, toolchain used, and deduplicated compiler errors/warnings extracted from the binary log.
-
Annotations: Blocked under
--read-only.
Executes unit tests and reports failures concisely.
-
Inputs:
-
project(string, optional): Test project name; default: every test project. -
filter(string, optional): Only tests whose fully qualified name contains this text. -
affectedBy(string, optional): Set tochangesor a symbol name to run only impacted tests. -
configuration(string, optional): Build configuration (default:Debug).
-
- Output: Summary counts, failure messages, and filtered user-code stack frames.
-
Annotations: Blocked under
--read-only.
Analyzes direct and transitive package dependencies across projects.
-
Inputs:
-
project(string, optional): Project name, asdotnet_overviewlists it. -
include(string, optional):all(default: direct and transitive),direct,vulnerable,deprecated,outdated; problem filters combine as 'any of'.
-
-
Features: Supports CPM (
Directory.Packages.props) andpackages.config, traces transitive dependency chains, and displays security advisories. -
Annotations:
openWorldHint: true
Extracts the verified public API surface and XML documentation of an exact package version.
-
Inputs:
-
package(string, required): NuGet package ID (e.g.Newtonsoft.Json). -
version(string, optional): Exact version string. -
query(string, optional): Type or member to find: exact name, prefix, camel-case humps or substring (best match only),Type.Member, or a documentation comment ID. -
targetFramework(string, optional): Target framework folder to inspect.
-
-
Annotations:
openWorldHint: true
Inventories legacy technologies, frameworks, and API usages.
-
Inputs:
-
project(string, optional): Project name, asdotnet_overviewlists it.
-
-
Output: Counts and locations of classic projects, .NET Framework targets, packages.config, WebForms, ASMX, WCF, WinForms, WPF,
BinaryFormatter,System.Configuration, binding redirects, and legacy hotspots. -
Annotations:
readOnlyHint: true
Inspects XML configuration files (web.config, app.config) with credentials masked.
-
Inputs:
-
path(string, optional): Path to configuration file. If omitted, lists all configuration files.
-
-
Output: App settings, connection strings (passwords masked), WCF service models, and the modern
appsettings.jsonstructural mapping. -
Annotations:
readOnlyHint: true
Identifies .NET Framework APIs that are missing or obsolete on modern .NET targets.
-
Inputs:
-
targetFramework(string, optional): Target framework (default:net10.0). -
project(string, optional): Project name, asdotnet_overviewlists it.
-
- Output: Grouped by technology, lists missing APIs, obsolete APIs with diagnostic codes, locations, and modern replacements.
-
Annotations:
readOnlyHint: true
Generates a structured, dependency-ordered modernization strategy.
-
Inputs:
-
targetFramework(string, optional): Migration target (default:net10.0). -
write(bool, optional): If true, writesassessment.md,plan.md, andtasks.mdtodocs/modernization/.
-
-
Annotations:
destructiveHint: true(it can write withwrite=true; without it, nothing is written)
Farol serves 7 MCP prompts that clients expose as slash commands: the four below, and since 0.3.0 the three skills (section 5).
-
explore(Explore a .NET solution): Guides the agent to map the solution usingdotnet_overview, search declarations usingdotnet_find_symbols, inspect signatures viadotnet_symbol, and trace references viadotnet_find_referencesanddotnet_call_hierarchy. -
verify_changes(Verify my .NET edits): Chainsdotnet_check(scopechanged) to verify new compiler errors, followed bydotnet_buildfor analyzer warnings, anddotnet_testwithaffectedBy='changes'to run affected unit tests. -
upgrade_package(Upgrade a NuGet package): Audits current package usage viadotnet_packages, compares API surfaces between current and target versions usingdotnet_package_api, highlights breaking changes, and verifies the upgrade withdotnet_checkanddotnet_test. -
modernize(Plan a .NET Framework modernization): Executes the full modernization playbook:dotnet_legacy_inventory,dotnet_portability,dotnet_config_inspect, anddotnet_migration_plan.
The playbook is three skills. Each is one file, plugins/farol/skills/<name>/SKILL.md, embedded in Farol.Tools, so every client gets the same text as the Claude Code plugin:
| Skill | For | Resource | Prompt |
|---|---|---|---|
modernize |
Moving .NET Framework code to modern .NET: inventory, portability, configuration, the plan, conversions | farol://skills/modernize |
skill_modernize |
maintain-legacy |
Changing .NET Framework code that stays there: WebForms, WCF, packages.config, VB | farol://skills/maintain-legacy |
skill_maintain_legacy |
refactor |
Renames, signatures, moves and extractions through Farol's write path, checked after each step | farol://skills/refactor |
skill_refactor |
A resource is the file byte for byte (text/markdown, front matter included). A prompt is its body without the front matter. The server instructions point agents at them.
dotnet_build, dotnet_test, dotnet_workspace and dotnet_convert_project declare execution.taskSupport: "optional" (MCP specification 2025-11-25). A client that sends task with the tools/call gets a CreateTaskResult at once, while the tool keeps running:
-
tasks/getreads the status (working,completed,failed,cancelled) and the status message, which is the tool's last progress message.notifications/tasks/statusreports changes, at most one per second. -
tasks/resultreturns the result a synchronous call would have returned.tasks/listpages the session's tasks, newest first. -
tasks/cancelstops the work. A build or test stops with its process tree; a convert puts back every file it wrote and reloads. - A call refused by its checks (arguments,
--read-only, a workspace another task is building) gets its synchronous answer and no task. While a build, test or convert task holds a workspace, another build or test of it is refused withconflictnaming the task. - Ended tasks stay in memory for
Farol:TaskRetentionMinutes(default 60, from 1 to 1440) or the client's shorterttl, at most 100 per session.Farol:Tasks=falseturns tasks off.
Implementation: the C# SDK 2.4.0 has no task types, so Infrastructure/Tasks builds them on the SDK's message filters:
- An incoming filter runs the call under a request id of its own (
farol-task-<id>), with the task's cancellation. - An outgoing filter keeps that call's response for
tasks/resultand turns its progress into status messages. It also adds thetaskscapability and each tool'sexecutionto the server's answers. - A tool tells the filter it accepted the call (
TaskCall.Admit) after its checks. That is when the client gets the task.
Clients: Claude Code 2.1.312 speaks MCP 2026-07-28 and uses that revision's tasks extension (io.modelcontextprotocol/tasks), which replaces these tasks. So it calls the four tools synchronously, as before. Support for the extension is deferred (spec 003).
Welcome to the official technical documentation for Farol, an open-source Model Context Protocol (MCP) server that equips AI coding agents (Claude Code, GitHub Copilot, Google Antigravity, Cursor, Codex) with compiler-accurate understanding of C# and VB.NET solutions.
- Home — Project overview, value proposition, quickstart, and problem statement
- 01. Architecture & Design Philosophy — Layered architecture, snapshot isolation, BuildHost model, design rationale
- 02. Layer: Farol.Core — Zero-Roslyn foundation: path sandbox, process execution, diffing, atomic writes, privacy
- 03. Layer: Farol.Engine — Workspaces & Loading — MSBuildWorkspaceLoader, analyzer copies, Visual Studio toolchain probing, background warmup, file watcher
- 04. Layer: Farol.Engine — Navigation & Markup — Compiler-accurate navigation, symbol search, IOperation classification, WebForms & XAML indexers, decompilation
- 05. Layer: Farol.Engine — Verification & Testing — Diagnostic checks in about a second, baseline fingerprinting, edits during a load, edit impact analysis, Code Actions, build & test runners
- 06. Layer: Farol.Engine — Legacy Modernization & Packages — Legacy inventory, config inspector, target surface portability, migration planner, NuGet API inspector
- 07. Layer: Farol.Tools & MCP Contract — Comprehensive reference for all 23 MCP tools, 7 prompts, the skill resources and MCP tasks
- 08. Layer: Farol.Host & CLI — Stdio transport, stream isolation, configuration precedence, privacy-first usage telemetry
- 09. Integrations & Plugins — Claude Code plugin (hook & skill), Visual Studio 2026, Copilot, Antigravity, VS Code, NuGet distribution
- 10. Benchmarks & Evals — Performance benchmarks (Umbraco & DNN Platform), evaluation suite and Phase 2 round, compiler oracle
- 11. Phase 2: Refactorings, Analyzers, Loaders & Index — Refactoring write path, analyzers in checks, heuristic and binlog loaders, persistent index, structured output, MCP Registry
- 12. Phase 3: MCP Tasks & Skills — Build, test, load and convert as MCP tasks; the playbook as three skills served by the server; exit results