MCPcopy Index your code
hub / github.com/Waishnav/devspace / runTool

Function runTool

src/pi-tools.ts:53–67  ·  view source on GitHub ↗
(
  execute: (input: TInput) => Promise<AgentToolResult<TDetails>>,
  input: TInput,
  context: ToolContext,
)

Source from the content-addressed store, hash-verified

51}
52
53async function runTool<TInput, TDetails = unknown>(
54 execute: (input: TInput) => Promise<AgentToolResult<TDetails>>,
55 input: TInput,
56 context: ToolContext,
57): Promise<ToolResponse<TDetails>> {
58 try {
59 const result = await execute(input);
60 return {
61 content: toMcpContent(result),
62 details: result.details,
63 };
64 } catch (error) {
65 return { content: formatToolError(error), isError: true };
66 }
67}
68
69export async function readFileTool(input: ReadToolInput, context: ToolContext): Promise<ToolResponse> {
70 const path = resolveAllowedPath(input.path, context.cwd, context.readRoots ?? [context.root]);

Callers 7

readFileToolFunction · 0.85
writeFileToolFunction · 0.85
editFileToolFunction · 0.85
grepFilesToolFunction · 0.85
findFilesToolFunction · 0.85
listDirectoryToolFunction · 0.85
runShellToolFunction · 0.85

Calls 2

toMcpContentFunction · 0.85
formatToolErrorFunction · 0.85

Tested by

no test coverage detected