Class SymbolTextTool
symbol_text: текст символа файла по имени или по позиции.
Дополняет document_symbols: тот отдаёт дерево с диапазонами, а этот — сам текст, чтобы
клиент без доступа к файловой системе сервера мог прочитать тело метода, не запрашивая файл целиком.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SymbolTextTool
-
-
Method Details
-
symbolText
@McpTool(name="symbol_text", description="Return the source text of a symbol of a 1C/OneScript file \u2014 a region, method or `\u041f\u0435\u0440\u0435\u043c`-declared variable, the symbols `document_symbols` shows. By `name` (case-insensitive): every such symbol with that name; `scope` keeps the ones declared in the given method, or at the module level with `$module`. By zero-based `line` and `character`: the symbol whose name is at the position, otherwise the innermost method or variable containing it (regions only by their name). Each match carries `scope`: the method it is declared in, or `$module`. For methods the description comment above the declaration is returned too.", generateOutputSchema=false, annotations=) public SymbolTextResultDto symbolText(@McpToolParam(required=true,description="Path to the .bsl/.os file (absolute or relative to the working directory). The file must lie inside a registered workspace folder \u2014 see the `list_workspace_folders` and `register_workspace_folder` tools.") String file, @McpToolParam(required=false,description="Name of a region, method or `\u041f\u0435\u0440\u0435\u043c`-declared variable of the file, case-insensitive. Pass either `name` or `line`; when both are given, `name` is used.") @Nullable String name, @McpToolParam(required=false,description="Only with `name`: where the symbol is declared \u2014 the name of a method of the file, or `$module` for the module level. Omit to get every symbol with that name.") @Nullable String scope, @McpToolParam(required=false,description="Zero-based line of a position in the file; the symbol at the position is returned. Pass either `name` or `line`.") @Nullable Integer line, @McpToolParam(required=false,description="Zero-based character of the position within `line`. Default 0, the start of the line.") @Nullable Integer character) Текст символа файла по имени или по позиции.Символы те же, что в дереве
document_symbols: области, методы и объявленные черезПеремпеременные. Поnameвозвращаются все такие символы с этим именем без учёта регистра;scopeоставляет из них объявленные в указанном методе или, при значении$module, на уровне модуля. По позиции возвращается символ, на имени которого она стоит, иначе самый вложенный метод или переменная, содержащие её: области по позиции находятся только по имени. У каждого символа указано, где он объявлен (scope), у метода дополнительно возвращается текст комментария-описания над объявлением. Текст берётся из свежего разбора документа (McpDocumentReader.analyze(String, Function)).- Parameters:
file- Путь к файлу.name- Имя символа;null, если поиск по позиции. Если переданы и имя, и позиция, используетсяname.scope- Имя метода файла или$module;null— без отбора. Учитывается только вместе сname.line- Строка позиции, zero-based;null, если поиск по имени.character- Символ позиции в строке, zero-based;nullравносильно 0.- Returns:
- Найденные символы с текстом.
- Throws:
IllegalArgumentException- Если не передан ниname, ниline, позиция отрицательна или вscopeуказан метод, которого в файле нет.
-