The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Effect from "effect/Effect"; |
| 2 | |
| 3 | import * as McpInvocationContext from "../../McpInvocationContext.ts"; |
| 4 | import * as McpToolAccess from "../../McpToolAccess.ts"; |
| 5 | import * as McpToolExposure from "../../McpToolExposure.ts"; |
| 6 | import { ToolSearchToolkit } from "./tools.ts"; |
| 7 | |
| 8 | export const layer = McpToolAccess.toLayer(ToolSearchToolkit, { |
| 9 | tool_search: McpToolAccess.readsAsCaller(({ query }) => |
| 10 | Effect.gen(function* () { |
| 11 | const { thread } = yield* McpInvocationContext.McpInvocationContext.pipe( |
| 12 | Effect.flatMap((scope) => McpInvocationContext.requireThreadScope(scope, "tool_search")), |
| 13 | ); |
| 14 | const exposure = yield* McpToolExposure.McpToolExposure; |
| 15 | return { tools: yield* exposure.search(thread.providerSessionId, query) }; |
| 16 | }), |
| 17 | ), |
| 18 | }); |