Skip to content

Commit 19cefa1

Browse files
Assistant: remove directory structure tool (#10870)
Addresses #10721, reworking the changes from #10517. Removes `getDirectoryStructure` in favor of a `directoriesOnly` argument to `getProjectTree` to save on input tokens and reduce the total number of tools. The same examples from the PR that originally introduced the tool, this time using `getProjectTree` with `directoriesOnly`. Efficiently exploring the root: <img width="1652" height="936" alt="Screenshot 2025-12-01 at 4 18 31 PM" src="https://github.com/user-attachments/assets/d7d72268-e6bb-43a1-bb19-a35cf460e233" /> Navigating a folder that's excluded by default by noticing that results were excluded and calling the tool again: <img width="1538" height="922" alt="Screenshot 2025-12-01 at 4 24 26 PM" src="https://github.com/user-attachments/assets/f7f76d8e-836a-4555-a0cc-d082d88df3ff" /> Seems like models can get just as much mileage out of this interface as with the dedicated tool. ### Release Notes <!-- Optionally, replace `N/A` with text to be included in the next release notes. The `N/A` bullets are ignored. If you refer to one or more Positron issues, these issues are used to collect information about the feature or bugfix, such as the relevant language pack as determined by Github labels of type `lang: `. The note will automatically be tagged with the language. These notes are typically filled by the Positron team. If you are an external contributor, you may ignore this section. --> #### New Features - Assistant: combine directory structure tool with project tree tool (#10721) #### Bug Fixes - N/A ### QA Notes <!-- Positron team members: please add relevant e2e test tags, so the tests can be run when you open this pull request. - Instructions: https://github.com/posit-dev/positron/blob/main/test/e2e/README.md#pull-requests-and-test-tags - Available tags: https://github.com/posit-dev/positron/blob/main/test/e2e/infra/test-runner/test-tags.ts --> <!-- Add additional information for QA on how to validate the change, paying special attention to the level of risk, adjacent areas that could be affected by the change, and any important contextual information not present in the linked issues. --> --------- Signed-off-by: Simon P. Couch <[email protected]> Co-authored-by: sharon <[email protected]>
1 parent 9873233 commit 19cefa1

File tree

5 files changed

+152
-374
lines changed

5 files changed

+152
-374
lines changed

extensions/positron-assistant/package.json

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@
754754
{
755755
"name": "getProjectTree",
756756
"displayName": "Get Project Tree",
757-
"modelDescription": "Get the project tree of the current workspace as a JSON object. This is useful for understanding the structure of the project and finding files. Empty folders are not included in the tree.",
757+
"modelDescription": "Get the project tree of the current workspace as a JSON object. This is useful for understanding the structure of the project and finding files. Empty folders are not included in the tree unless `directoriesOnly` is true. Set `directoriesOnly` to true to return only directories without listing files within them; this is more efficient for discovering directories.",
758758
"icon": "$(file-directory)",
759759
"toolReferenceName": "projectTree",
760760
"userDescription": "Get the project tree of the current workspace.",
@@ -787,73 +787,22 @@
787787
"description": "Whether to skip all automatic exclusions (.gitignore rules, VS Code exclude settings, and default exclusions for dependencies, build artifacts, and other commonly ignored files/directories). When true, only the explicit `exclude` patterns will be applied.",
788788
"default": false
789789
},
790-
"maxFiles": {
790+
"maxItems": {
791791
"type": "number",
792-
"description": "The maximum number of files to include in the project tree (<=50). If this limit is reached, a compressed description of the project will be provided instead.",
792+
"description": "The maximum number of items (files or directories) to include in the project tree (<=50). If this limit is reached, a compressed description of the project will be provided instead.",
793793
"default": 50
794+
},
795+
"directoriesOnly": {
796+
"type": "boolean",
797+
"description": "When true, returns only directories without listing files within them. Empty directories are included. This is more efficient for directory queries. Prefer this over running code in the terminal for finding directories.",
798+
"default": false
794799
}
795800
},
796801
"required": [
797802
"include"
798803
]
799804
}
800805
},
801-
{
802-
"name": "getDirectoryStructure",
803-
"displayName": "Get Directory Structure",
804-
"modelDescription": "Returns a list of directories without listing files within them. Empty directories are included. Unlike getProjectTree, this tool focuses on directories only and is more efficient for directory queries. Prefer this tool over running code in the terminal for finding directories.",
805-
"icon": "$(folder)",
806-
"toolReferenceName": "directoryStructure",
807-
"userDescription": "Get the directory structure of the workspace.",
808-
"canBeReferencedInPrompt": true,
809-
"tags": [
810-
"positron-assistant",
811-
"requires-workspace"
812-
],
813-
"inputSchema": {
814-
"type": "object",
815-
"properties": {
816-
"path": {
817-
"type": "string",
818-
"description": "Starting path to explore (relative to workspace root). Defaults to workspace root if not specified."
819-
},
820-
"maxDepth": {
821-
"type": "number",
822-
"description": "Maximum recursion depth. 1 shows only immediate subdirectories. Must be between 1 and 3.",
823-
"default": 1,
824-
"minimum": 1,
825-
"maximum": 3
826-
},
827-
"maxDirectories": {
828-
"type": "number",
829-
"description": "Maximum number of directories to return.",
830-
"default": 50,
831-
"maximum": 100
832-
},
833-
"include": {
834-
"type": "array",
835-
"items": {
836-
"type": "string",
837-
"description": "A glob pattern to include directories."
838-
},
839-
"description": "Glob patterns to include directories. Only directories matching these patterns will be returned."
840-
},
841-
"exclude": {
842-
"type": "array",
843-
"items": {
844-
"type": "string",
845-
"description": "A glob pattern to exclude directories."
846-
},
847-
"description": "Glob patterns to exclude directories. These patterns will be applied in addition to the default excludes unless `skipDefaultExcludes` is true."
848-
},
849-
"skipDefaultExcludes": {
850-
"type": "boolean",
851-
"description": "Whether to skip all automatic exclusions (.gitignore rules, VS Code exclude settings, and default exclusions for dependencies, build artifacts, and other commonly ignored directories). When true, only the explicit `exclude` patterns will be applied.",
852-
"default": false
853-
}
854-
}
855-
}
856-
},
857806
{
858807
"name": "getChangedFiles",
859808
"displayName": "Get changed files",

extensions/positron-assistant/src/tools.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as positron from 'positron';
88
import { ParticipantService } from './participants.js';
99
import { PositronAssistantToolName } from './types.js';
1010
import { ProjectTreeTool } from './tools/projectTreeTool.js';
11-
import { DirectoryStructureTool } from './tools/directoryStructureTool.js';
1211
import { getWorkspaceGitChanges, GitRepoChangeKind } from './git.js';
1312
import { DocumentCreateTool } from './tools/documentCreate.js';
1413
import { registerNotebookTools } from './tools/notebookTools.js';
@@ -412,8 +411,6 @@ export function registerAssistantTools(
412411

413412
context.subscriptions.push(ProjectTreeTool);
414413

415-
context.subscriptions.push(DirectoryStructureTool);
416-
417414
context.subscriptions.push(DocumentCreateTool);
418415

419416
// Register notebook-specific tools for notebook participant

extensions/positron-assistant/src/tools/directoryStructureTool.ts

Lines changed: 0 additions & 258 deletions
This file was deleted.

0 commit comments

Comments
 (0)