# Specification: C# MCP Tools

## Overview
Expand the Conductor's AI context-gathering and surgical editing capabilities by introducing full Tree-Sitter parsing support for C#. This brings C# to feature-parity with existing Python MCP tools, enabling deep AST-driven structural mapping, documentation extraction, and precise code modification, specifically targeting Unreal Engine build scripts, and Unity/Godot scripting.

## Functional Requirements
- **Grammar Integration:**
  - Introduce the stable `tree-sitter-c-sharp` grammar to the project's parsing environment as a native dependency to generate deterministic Abstract Syntax Trees for `.cs` files.
- **Structural Parsing Tools:**
  - **`cs_get_skeleton`:** Extract a high-level view of a C# file, containing all namespaces, class/struct/interface declarations, fields, properties, and method signatures with their associated XML docstrings. Method bodies will be replaced with `...`.
  - **`cs_get_code_outline`:** Generate a hierarchical text outline showing line ranges for major structural elements (namespaces, classes, methods).
- **Documentation & Context Tools:**
  - **`cs_get_docstring`:** Extract the XML docstring (`///`) immediately preceding a class, field, property, or method definition.
  - **`cs_find_usages`:** Locate usages of specific C# symbols across a file or directory using strict regex or AST node analysis.
- **Surgical Editing Tools:**
  - **`cs_get_definition`:** Extract the full source code of a specific C# method, class, or property.
  - **`cs_update_definition`:** Surgically replace the implementation of a specific C# method or class without relying on generic search-and-replace strings.
  - **`cs_set_signature`:** Update only the signature (modifiers, return type, parameters) of a C# method.

## Non-Functional Requirements
- **Performance:** Parsing and skeleton generation should utilize the existing `mtime` invalidation cache to ensure near-instantaneous responses.
- **Robustness:** The parser must gracefully handle malformed or incomplete C# code (e.g., during active development), returning as much structural information as possible rather than failing entirely.

## Acceptance Criteria
- [ ] A new suite of C#-specific tools (`cs_get_skeleton`, `cs_get_code_outline`, `cs_get_definition`, `cs_update_definition`) is registered and available via the MCP Client.
- [ ] Automated tests verify that `cs_get_skeleton` correctly identifies namespaces, classes, methods, and C#-specific constructs (like attributes `[Serializable]` and properties `{ get; set; }`).
- [ ] `cs_update_definition` successfully replaces a multi-line method body while maintaining the surrounding file structure and indentation.
- [ ] The `tree-sitter-c-sharp` native dependency is successfully integrated into the python environment setup (`uv` / `requirements.txt`).

## Out of Scope
- Full language server protocol (LSP) features like deep cross-file type inference, semantic variable renaming, or Roslyn integration.
- Automated code formatting or linting for C# (this relies on external ecosystem tools like `dotnet format`).
