mirror of
https://github.com/sbroenne/mcp-server-excel.git
synced 2026-09-19 07:53:08 +08:00
316df5ae02
* feat: Add Rename operations for Power Query and Data Model tables This feature adds rename capabilities to both Power Query and Data Model tools: ## Power Query Rename - New 'Rename' action in excel_powerquery MCP tool - New 'powerquery rename' CLI command - Validates: empty names, no-op (same name), duplicate conflicts - Case-insensitive conflict detection - 10 integration tests covering all scenarios ## Data Model RenameTable - New 'RenameTable' action in excel_datamodel MCP tool - New 'datamodel rename-table' CLI command - Handles Excel COM limitation: ModelTable.Name is read-only - For PQ-backed tables: renames underlying query, returns clear error explaining table name is cached - For non-PQ tables: returns clear error about immutability - 12 integration tests covering edge cases ## Implementation Details - RenameNameRules.cs: Shared validation (Normalize, IsEmpty, IsNoOp, HasConflict) - COM object cleanup in finally blocks per CRITICAL-RULES - Exception propagation via batch.Execute() pattern - 6 MCP contract tests + 2 smoke tests added ## Documentation Updated - Operation counts: MCP 180->182, CLI 172->174 - All READMEs updated (root, MCP Server, CLI, VS Code extension, gh-pages) - FEATURES.md updated with new operations - Quickstart examples for both CLI and MCP usage ## Tests: 140 passing (130 Core + 10 MCP) Resolves spec: 001-rename-queries-tables All 33 tasks complete (T001-T033) * perf: optimize COM interop for bulk writes and idle CPU usage - TableCommands.Append: Replace cell-by-cell writing with bulk range write Uses single Value2 array assignment instead of N×M individual COM calls Provides 100x+ performance improvement for large data appends - ExcelBatch message pump: Replace Thread.Sleep(10) polling with async wait Uses WaitToReadAsync for efficient blocking until work is available Reduces idle CPU usage from ~1-5% to near-zero Tested: 20/20 Table tests passed, 84/84 ComInterop tests passed