# Implementation Plan: C# MCP Tools

## Phase 1: Grammar Integration & Base Parser
- [ ] Task: Update project dependencies (e.g., `requirements.txt` or `pyproject.toml`) to include the native `tree-sitter-c-sharp` dependency.
- [ ] Task: Write Tests: Verify the tree-sitter parser can successfully initialize the C# language and parse a simple `namespace { class A { void M() {} } }` string.
- [ ] Task: Implement: Create `src/csharp_parser.py` (or extend existing AST parsers) to handle the base C# tree-sitter initialization and generic node walking.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Grammar Integration & Base Parser' (Protocol in workflow.md)

## Phase 2: Structural & Context Tools
- [ ] Task: Write Tests: Verify `cs_get_skeleton` and `cs_get_code_outline` against a complex C# file containing namespaces, classes, properties, attributes, and XML docstrings.
- [ ] Task: Implement: Add `cs_get_skeleton` logic to extract namespaces, classes, method signatures, attributes, and replace bodies with `...`.
- [ ] Task: Implement: Add `cs_get_code_outline` and `cs_get_docstring` logic to traverse the AST and map line numbers and comments.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Structural & Context Tools' (Protocol in workflow.md)

## Phase 3: Surgical Editing Tools
- [ ] Task: Write Tests: Verify `cs_get_definition` returns the exact source text of a targeted method or class, and `cs_update_definition` replaces it accurately within a larger file.
- [ ] Task: Implement: Add `cs_get_definition` logic using AST line/byte ranges.
- [ ] Task: Implement: Add `cs_update_definition` and `cs_set_signature` logic to perform string replacement based on strict AST node boundaries.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Surgical Editing Tools' (Protocol in workflow.md)

## Phase 4: MCP Client Integration & Polish
- [ ] Task: Write Tests: Verify the new tools are successfully registered and invokable via the `mcp_client.py` unified interface.
- [ ] Task: Implement: Register the new `cs_*` functions as official tools in `src/mcp_client.py`.
- [ ] Task: Implement: Ensure the caching layer (mtime invalidation) is correctly applied to the new C# parsing operations.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: MCP Client Integration & Polish' (Protocol in workflow.md)
