The best way to control Claude Code, Codex and more from any computer or phone

main
ts 137 lines 7.65 KB
Raw
1 import { mFallback, msg } from "gt-i18n";
2 import type { MFunctionType } from "gt-i18n/types";
3
4 import { resolveT3McpToolDefinition, type T3McpToolPresentation } from "./t3McpToolPresentation.ts";
5
6 // Same English as each tool's displayName; a name missing here shows as authored.
7 const DISPLAY_NAMES: ReadonlyMap<string, string> = new Map([
8 ["Link a pull request", msg("Link a pull request")],
9 ["Link pull requests", msg("Link pull requests")],
10 ["Unlink a pull request", msg("Unlink a pull request")],
11 ["Unlink pull requests by state", msg("Unlink pull requests by state")],
12 ["Check linked pull requests", msg("Check linked pull requests")],
13 ["Watch a pull request", msg("Watch a pull request")],
14 ["Stop watching a pull request", msg("Stop watching a pull request")],
15 ["Write review guides", msg("Write review guides")],
16 ["Read a review guide", msg("Read a review guide")],
17 ["Read a pull request", msg("Read a pull request")],
18 ["List pull requests", msg("List pull requests")],
19 ["Open a pull request", msg("Open a pull request")],
20 ["Update a pull request", msg("Update a pull request")],
21 ["Respond on a pull request", msg("Respond on a pull request")],
22 ["Review a pull request", msg("Review a pull request")],
23 ["Merge a pull request", msg("Merge a pull request")],
24 ["Read CI logs", msg("Read CI logs")],
25 ["Re-run CI", msg("Re-run CI")],
26 ["List issues", msg("List issues")],
27 ["Read an issue", msg("Read an issue")],
28 ["File an issue", msg("File an issue")],
29 ["Comment on an issue", msg("Comment on an issue")],
30 ["Change an issue's state", msg("Change an issue's state")],
31 ["Link an issue", msg("Link an issue")],
32 ["Unlink an issue", msg("Unlink an issue")],
33 ["Check linked issues", msg("Check linked issues")],
34 ["Get orchestration capabilities", msg("Get orchestration capabilities")],
35 ["Delegate a child task", msg("Delegate a child task")],
36 ["Get delegated task status", msg("Get delegated task status")],
37 ["Cancel a delegated task", msg("Cancel a delegated task")],
38 ["Schedule a task", msg("Schedule a task")],
39 ["List scheduled tasks", msg("List scheduled tasks")],
40 ["Update a scheduled task", msg("Update a scheduled task")],
41 ["Delete a scheduled task", msg("Delete a scheduled task")],
42 ["Ask for a secret", msg("Ask for a secret")],
43 ["Create T3 threads", msg("Create T3 threads")],
44 ["Start a T3 thread", msg("Start a T3 thread")],
45 ["List T3 threads", msg("List T3 threads")],
46 ["Read a T3 thread", msg("Read a T3 thread")],
47 ["Send to a T3 thread", msg("Send to a T3 thread")],
48 ["Wait for a T3 thread", msg("Wait for a T3 thread")],
49 ["Stop a workflow", msg("Stop a workflow")],
50 ["Update background waits", msg("Update background waits")],
51 ["Interrupt a T3 thread", msg("Interrupt a T3 thread")],
52 ["Hand off thread to a git worktree", msg("Hand off thread to a git worktree")],
53 ["Get thread worktree status", msg("Get thread worktree status")],
54 ["Get preview browser status", msg("Get preview browser status")],
55 ["Open a page in the preview browser", msg("Open a page in the preview browser")],
56 ["Navigate the preview browser", msg("Navigate the preview browser")],
57 ["Respond to a preview browser dialog", msg("Respond to a preview browser dialog")],
58 ["Snapshot the preview page", msg("Snapshot the preview page")],
59 ["Use the preview browser", msg("Use the preview browser")],
60 ["Click in the preview browser", msg("Click in the preview browser")],
61 ["Press a key in the preview browser", msg("Press a key in the preview browser")],
62 ["Type in the preview browser", msg("Type in the preview browser")],
63 ["Hover in the preview browser", msg("Hover in the preview browser")],
64 ["Choose an option in the preview browser", msg("Choose an option in the preview browser")],
65 ["Drag in the preview browser", msg("Drag in the preview browser")],
66 ["Upload files to the preview browser", msg("Upload files to the preview browser")],
67 ["Scroll the preview browser", msg("Scroll the preview browser")],
68 ["Resize the preview browser", msg("Resize the preview browser")],
69 ["Evaluate script in the preview browser", msg("Evaluate script in the preview browser")],
70 ["Wait for the preview page", msg("Wait for the preview page")],
71 ["Set preview browser appearance", msg("Set preview browser appearance")],
72 ["Start recording the preview browser", msg("Start recording the preview browser")],
73 ["Stop recording the preview browser", msg("Stop recording the preview browser")],
74 ["List simulators and emulators", msg("List simulators and emulators")],
75 ["Open a device in the Device panel", msg("Open a device in the Device panel")],
76 ["Take a screenshot of the device", msg("Take a screenshot of the device")],
77 ["Close a device", msg("Close a device")],
78 ["Run a scheduled task", msg("Run a scheduled task")],
79 ["Manage queued messages", msg("Manage queued messages")],
80 ["Handle pending questions", msg("Handle pending questions")],
81 ["List queued messages", msg("List queued messages")],
82 ["Read a queued message", msg("Read a queued message")],
83 ["Edit a queued message", msg("Edit a queued message")],
84 ["Cancel a queued run", msg("Cancel a queued run")],
85 ["Reorder a queued run", msg("Reorder a queued run")],
86 ["Steer with a queued message", msg("Steer with a queued message")],
87 ["List pending questions", msg("List pending questions")],
88 ["Read pending questions", msg("Read pending questions")],
89 ["Answer pending questions", msg("Answer pending questions")],
90 ["Read thread configuration", msg("Read thread configuration")],
91 ["Use thread model settings", msg("Use thread model settings")],
92 ["Use thread transfers", msg("Use thread transfers")],
93 ["Fork this thread", msg("Fork this thread")],
94 ["Merge thread context", msg("Merge thread context")],
95 ["Search thread content", msg("Search thread content")],
96 ["Read thread transfers", msg("Read thread transfers")],
97 ["Organize a thread", msg("Organize a thread")],
98 ["Update T3 thread metadata", msg("Update T3 thread metadata")],
99 ["List workspace branches", msg("List workspace branches")],
100 ["List preview tabs", msg("List preview tabs")],
101 ["Close a preview tab", msg("Close a preview tab")],
102 ["Read environment preferences", msg("Read environment preferences")],
103 ["List linked environments", msg("List linked environments")],
104 ["Ask to link an environment", msg("Ask to link an environment")],
105 ["Forget a linked environment", msg("Forget a linked environment")],
106 ["Update environment preferences", msg("Update environment preferences")],
107 ["Read themes", msg("Read themes")],
108 ["Set the theme", msg("Set the theme")],
109 ["Launch a project thread", msg("Launch a project thread")],
110 ["List projects", msg("List projects")],
111 ["Read a project", msg("Read a project")],
112 ["Register a project", msg("Register a project")],
113 ["Update a project", msg("Update a project")],
114 ["Delete a project", msg("Delete a project")],
115 ["Clone a repository", msg("Clone a repository")],
116 ["Prepare an attachment upload", msg("Prepare an attachment upload")],
117 ["Discard a pending attachment", msg("Discard a pending attachment")],
118 ["Send attachments", msg("Send attachments")],
119 ["Preview an HTML page", msg("Preview an HTML page")],
120 ["Render an HTML page", msg("Render an HTML page")],
121 ["Send a message", msg("Send a message")],
122 ]);
123
124 /** @public */
125 export function resolveT3McpToolPresentation(
126 toolName: string | null | undefined,
127 input?: unknown,
128 resolve: MFunctionType = mFallback,
129 ): T3McpToolPresentation | null {
130 const definition = resolveT3McpToolDefinition(toolName, input);
131 if (definition === null) return null;
132 const displayName = DISPLAY_NAMES.get(definition.displayName);
133 return {
134 displayName: displayName === undefined ? definition.displayName : resolve(displayName),
135 logo: "t3-code",
136 };
137 }