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

Function readFileTool

src/pi-tools.ts:69–78  ·  view source on GitHub ↗
(input: ReadToolInput, context: ToolContext)

Source from the content-addressed store, hash-verified

67}
68
69export async function readFileTool(input: ReadToolInput, context: ToolContext): Promise<ToolResponse> {
70 const path = resolveAllowedPath(input.path, context.cwd, context.readRoots ?? [context.root]);
71 const tool = createReadTool(context.cwd);
72
73 return runTool((params) => tool.execute("read_file", params), {
74 path,
75 offset: input.offset,
76 limit: input.limit,
77 }, context);
78}
79
80export async function writeFileTool(input: WriteToolInput, context: ToolContext): Promise<ToolResponse> {
81 const path = resolveAllowedPath(input.path, context.cwd, [context.root]);

Callers 1

createMcpServerFunction · 0.85

Calls 2

resolveAllowedPathFunction · 0.85
runToolFunction · 0.85

Tested by

no test coverage detected