Open History to see the last commit
1import { OrchestratorMcpFailure } from "@t3tools/contracts";
2import * as Schema from "effect/Schema";
3import { McpSchema, Tool, Toolkit } from "effect/ai";
4
5import * as McpInvocationContext from "../../McpInvocationContext.ts";
6import * as McpToolExposure from "../../McpToolExposure.ts";
7
8const ToolSearchTool = Tool.make(McpToolExposure.TOOL_SEARCH, {
9 description:
10 "Find T3 Code tools you do not have yet. If tool_call is available, pass it the returned tool's name and your arguments. Otherwise search loads the tools so you can call them by name. Search by name or purpose: threads (t3_thread_*), projects (t3_project_*), worktrees, preview_* browser, device_*, html_preview/html_render, schedule_task, pull requests and guides, attachments, request_secret, environment links. Exact names work too.",
11 parameters: Schema.Struct({ query: Schema.String.check(Schema.isMaxLength(500)) }),
12 success: Schema.Struct({
13 tools: Schema.Array(
14 Schema.Struct({
15 name: Schema.String,
16 description: Schema.String,
17 inputSchema: Schema.optional(Schema.Unknown),
18 }),
19 ),
20 }),
21 failure: OrchestratorMcpFailure,
22 failureMode: "return",
23 dependencies: [McpInvocationContext.McpInvocationContext, McpToolExposure.McpToolExposure],
24})
25 .annotate(Tool.Readonly, true)
26 .annotate(Tool.Destructive, false)
27 .annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenFromOutsideClients);
28
29export const ToolSearchToolkit = Toolkit.make(ToolSearchTool);