MCPcopy Create free account
hub / github.com/cloudflare/computer / createAITools

Function createAITools

packages/computer/src/tools/ai.ts:20–44  ·  view source on GitHub ↗
(options: CreateAIToolsOptions)

Source from the content-addressed store, hash-verified

18}
19
20export function createAITools(options: CreateAIToolsOptions): ToolSet {
21 const store = new WorkspaceFileStore(options.workspace);
22 const tools: ToolSet = {
23 read: createReadTool({ store, ...options.read }),
24 ls: createListTool({ workspace: options.workspace }),
25 };
26
27 if (options.readonly === true) return tools;
28
29 tools.write = createWriteTool({ store, ...options.write });
30 tools.edit = createEditTool({ store, ...options.edit });
31
32 if (options.shell !== undefined) {
33 tools.exec = createExecTool({
34 workspace: options.workspace as ExecWorkspaceLike,
35 ...options.shell,
36 });
37 }
38
39 if (options.assets !== false && options.workspace.assets !== undefined) {
40 tools.publish = createPublishTool({ workspace: options.workspace as PublishWorkspaceLike });
41 }
42
43 return tools;
44}

Callers 2

getToolsMethod · 0.90
ai.test.tsFile · 0.85

Calls 6

createReadToolFunction · 0.85
createListToolFunction · 0.85
createWriteToolFunction · 0.85
createEditToolFunction · 0.85
createExecToolFunction · 0.85
createPublishToolFunction · 0.85

Tested by

no test coverage detected