Class RegisterWorkspaceFolderTool
java.lang.Object
com.github._1c_syntax.bsl.languageserver.mcp.tools.RegisterWorkspaceFolderTool
MCP-инструмент
register_workspace_folder: регистрирует каталог как рабочую папку
(workspace folder в терминах LSP — корень проекта, а не подкаталог с исходниками:
конфигурационный файл .bsl-language-server.json читается только из корня) и индексирует
её исходники 1С/OneScript, после чего файлы папки становятся видны остальным инструментам,
а её uri — допустимым значением параметра workspaceFolder.
Повторная регистрация уже зарегистрированного каталога переиндексацию не запускает: возвращается
текущее состояние с признаком alreadyRegistered.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordРезультат регистрации. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionregisterWorkspaceFolder(String path, @Nullable String name) Зарегистрировать каталог как рабочую папку.
-
Constructor Details
-
RegisterWorkspaceFolderTool
@ConstructorProperties("workspaceBootstrap") public RegisterWorkspaceFolderTool(McpWorkspaceBootstrap workspaceBootstrap)
-
-
Method Details
-
registerWorkspaceFolder
@McpTool(name="register_workspace_folder", description="Add a workspace folder to this server and index its 1C:Enterprise (BSL) and OneScript sources, so that the other BSL tools can analyse it. Required before analysing any project the `list_workspace_folders` tool does not already report.\nPass the project root directory \u2014 a workspace folder in the LSP sense, the folder an editor opens \u2014 not a subfolder of it and not a single file: `.bsl-language-server.json` is only read from the folder root.\nIndexing a large configuration may take a while; adding an already registered folder returns immediately without re-indexing. Returns the `uri` to pass to the other tools as `workspaceFolder`. Nothing on disk is modified.", generateOutputSchema=false, annotations=) public RegisterWorkspaceFolderTool.Result registerWorkspaceFolder(@McpToolParam(required=true,description="Path to the workspace folder to register \u2014 an LSP workspace folder in the protocol's sense: the project root directory an editor opens, not a subfolder of it. It holds the sources (`src/cf` of a 1C configuration, the OneScript sources) and, when present, `.bsl-language-server.json`, which is only read from the folder root.\nMust be a directory, not a single file. Accepts an absolute path, a `file:` URI, or a relative path \u2014 a relative one is resolved against the server working directory, which the client usually does not control, so prefer an absolute path.") String path, @McpToolParam(required=false,description="Optional display name of the workspace folder, the same thing as `name` of an LSP workspace folder: how the folder is referred to in a user interface. Defaults to the name of the registered directory.") @Nullable String name) Зарегистрировать каталог как рабочую папку.Побочный эффект: для нового каталога выполняется индексация исходников — операция может быть длительной. Уже зарегистрированный каталог не переиндексируется, возвращается его текущее состояние.
- Parameters:
path- Каталог рабочей папки: абсолютный или относительный путь либоfile:-URI.name- Имя рабочей папки;null— взять из имени каталога.- Returns:
- Рабочая папка и признак того, что она была зарегистрирована ранее.
- Throws:
IllegalArgumentException- Если путь пуст, не указывает на локальный каталог, не существует либо является файлом.
-