|
1 | 1 | import { |
2 | 2 | WorktreeMcpFailure, |
| 3 | + OrchestratorMcpFailure, |
| 4 | + VcsListRefsInput, |
| 5 | + VcsListRefsResult, |
3 | 6 | WorktreeMcpHandoffInput, |
4 | 7 | WorktreeMcpHandoffResult, |
5 | 8 | WorktreeMcpStatusResult, |
6 | 9 | } from "@t3tools/contracts"; |
| 10 | +import * as Schema from "effect/Schema"; |
| 11 | +import { GitWorkflowService } from "../../../git/GitWorkflowService.ts"; |
| 12 | +import { ProjectService } from "../../../project/ProjectService.ts"; |
| 13 | +import { ThreadManagementService } from "../../../orchestration-v2/ThreadManagementService.ts"; |
7 | 14 | import { Tool, Toolkit } from "effect/unstable/ai"; |
8 | 15 |
|
9 | 16 | import * as McpInvocationContext from "../../McpInvocationContext.ts"; |
@@ -44,4 +51,30 @@ export const WorktreeStatusTool = Tool.make("t3_worktree_status", { |
44 | 51 | .annotate(Tool.Idempotent, true) |
45 | 52 | .annotate(Tool.OpenWorld, false); |
46 | 53 |
|
47 | | -export const WorktreeToolkit = Toolkit.make(WorktreeHandoffTool, WorktreeStatusTool); |
| 54 | +export const WorktreeListTool = Tool.make("t3_worktree_list", { |
| 55 | + description: |
| 56 | + "List branch refs and their associated checkout paths for this thread's workspace using the app's ref inventory. Detached worktrees without a branch are not included. Use t3_worktree_status for the thread binding and t3_worktree_handoff to create a new worktree.", |
| 57 | + parameters: Schema.Struct({ |
| 58 | + query: VcsListRefsInput.fields.query, |
| 59 | + cursor: VcsListRefsInput.fields.cursor, |
| 60 | + limit: VcsListRefsInput.fields.limit, |
| 61 | + refKind: VcsListRefsInput.fields.refKind, |
| 62 | + includeMatchingRemoteRefs: VcsListRefsInput.fields.includeMatchingRemoteRefs, |
| 63 | + }), |
| 64 | + success: VcsListRefsResult, |
| 65 | + failure: OrchestratorMcpFailure, |
| 66 | + failureMode: "return", |
| 67 | + dependencies: [ |
| 68 | + McpInvocationContext.McpInvocationContext, |
| 69 | + ThreadManagementService, |
| 70 | + ProjectService, |
| 71 | + GitWorkflowService, |
| 72 | + ], |
| 73 | +}) |
| 74 | + .annotate(Tool.Readonly, true) |
| 75 | + .annotate(Tool.Destructive, false); |
| 76 | +export const WorktreeToolkit = Toolkit.make( |
| 77 | + WorktreeHandoffTool, |
| 78 | + WorktreeStatusTool, |
| 79 | + WorktreeListTool, |
| 80 | +); |
0 commit comments