| 1 | namespace CascadeIDE.Services; |
| 2 | |
| 3 | /// <summary>Список MCP-тулов IDE и команды редактора/документов (ide_execute_command).</summary> |
| 4 | public static partial class IdeCommands |
| 5 | { |
| 6 | // ——— MCP / редактор |
| 7 | /// <summary>Список MCP-тулов, которые IDE публикует (name/description/inputSchema). returns: json.</summary> |
| 8 | public const string ListTools = "list_tools"; |
| 9 | |
| 10 | /// <summary>Открыть файл в редакторе IDE. args: path:string; returns: text; example: {"path":"C:\\tmp\\a.txt"}.</summary> |
| 11 | public const string OpenFile = "open_file"; |
| 12 | /// <summary>Загрузить решение (.sln/.slnx/.slnf), один проект (.csproj/.fsproj) или каталог как workspace (дерево без .sln) — обновить обозреватель. args: path:string; returns: text; example: {"path":"D:\\repo\\MyApp.csproj"}.</summary> |
| 13 | public const string LoadSolution = "load_solution"; |
| 14 | /// <summary>Выделить диапазон в редакторе (1-based). args: file_path:string, start_line:integer, start_column:integer, end_line:integer, end_column:integer; returns: text; example: {"file_path":"C:\\tmp\\a.cs","start_line":1,"start_column":1,"end_line":1,"end_column":10}.</summary> |
| 15 | public const string Select = "select"; |
| 16 | /// <summary>Поставить брейкпоинт: при необходимости загрузка найденного .sln/.slnx/.slnf, запись в JSON отладки, открытие файла и переход к строке. args: file_path:string, line:integer, condition?:string; returns: text; example: {"file_path":"C:\\tmp\\a.cs","line":42}.</summary> |
| 17 | public const string SetBreakpoint = "set_breakpoint"; |
| 18 | /// <summary>Снять брейкпоинт. args: file_path:string, line:integer; returns: text; example: {"file_path":"C:\\tmp\\a.cs","line":42}.</summary> |
| 19 | public const string RemoveBreakpoint = "remove_breakpoint"; |
| 20 | /// <summary>Показать Markdown-превью в отдельном окне. args: title:string, content:string; returns: text; example: {"title":"Plan","content":"- step 1\n- step 2"}.</summary> |
| 21 | public const string ShowPreview = "show_preview"; |
| 22 | /// <summary>Показать превью текущего файла из редактора в отдельном окне (контент берётся из IDE). returns: text.</summary> |
| 23 | public const string ShowEditorPreview = "show_editor_preview"; |
| 24 | /// <summary>Запросить подтверждение у пользователя. args: message:string; returns: text; example: {"message":"Продолжить?"}. Возвращает <c>ok</c>/<c>cancel</c>.</summary> |
| 25 | public const string RequestConfirmation = "request_confirmation"; |
| 26 | /// <summary>Состояние активного редактора: файл, каретка, выделение. args: max_preview_chars?:integer; returns: json; example: {"max_preview_chars":0}.</summary> |
| 27 | public const string GetEditorState = "get_editor_state"; |
| 28 | /// <summary>Текст активного редактора по диапазону строк (1-based). args: start_line:integer, end_line:integer; returns: json; example: {"start_line":1,"end_line":40}.</summary> |
| 29 | public const string GetEditorContentRange = "get_editor_content_range"; |
| 30 | /// <summary>Полный текст открытого документа по пути (или текущего). Модель вкладки, не снимок темы. returns: text.</summary> |
| 31 | public const string GetOpenDocumentText = "get_open_document_text"; |
| 32 | /// <summary>Прочитать файл workspace с диска (не только открытые вкладки). args: file_path:string, offset?:integer, limit?:integer, max_chars?:integer; returns: json; example: {"file_path":"src/Program.cs"}.</summary> |
| 33 | public const string ReadWorkspaceFile = "read_workspace_file"; |
| 34 | /// <summary>Сохранить документ на диск: буфер открытой вкладки или полная замена content. args: file_path?:string, content?:string; returns: json; example: {"file_path":"src/Program.cs"}.</summary> |
| 35 | public const string SaveDocument = "save_document"; |
| 36 | /// <summary>Применить текстовую правку в открытом документе. args: file_path:string, start_line:integer, start_column:integer, end_line:integer, end_column:integer, new_text:string; returns: text; example: {"file_path":"C:\\tmp\\a.cs","start_line":1,"start_column":1,"end_line":1,"end_column":1,"new_text":"// hi\n"}.</summary> |
| 37 | public const string ApplyEdit = "apply_edit"; |
| 38 | /// <summary>Перейти на позицию (и опционально выделить диапазон). args: file_path:string, line:integer, column:integer, end_line?:integer, end_column?:integer; returns: text; example: {"file_path":"C:\\tmp\\a.cs","line":10,"column":1}.</summary> |
| 39 | public const string GoToPosition = "go_to_position"; |
| 40 | /// <summary>Показать диапазон строк в редакторе transient-подсветкой без изменения selection (ADR 0130). args: file_path:string, start_line?:integer, end_line?:integer, member_key?:string, syntax_scope?:object, duration_ms?:integer; returns: text; example: {"file_path":"C:\\tmp\\a.cs","start_line":10,"end_line":25,"duration_ms":4000}.</summary> |
| 41 | public const string RevealEditorRange = "reveal_editor_range"; |
| 42 | |
| 43 | /// <summary>Живость MCP-хоста IDE (без аргументов). Имя MCP-тула: <c>ide_ping</c>. returns: json.</summary> |
| 44 | public const string IdePing = "ping"; |
| 45 | |
| 46 | /// <summary>Пересоздать клиентов внешних MCP и сбросить сессию Cursor ACP (после сбоев транспорта). Имя MCP-тула: <c>ide_restart_mcp_clients</c>. returns: json.</summary> |
| 47 | public const string IdeRestartMcpClients = "restart_mcp_clients"; |
| 48 | } |
| 49 | |