MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / toolFileContent

Function toolFileContent

packages/hosts/mcp/src/tool-server.ts:338–359  ·  view source on GitHub ↗
(file: ToolFileValue)

Source from the content-addressed store, hash-verified

336};
337
338const toolFileContent = (file: ToolFileValue): ContentBlock[] => {
339 const kind = toolFileKind(file);
340 if (kind === "image") {
341 return [{ type: "image", data: file.data, mimeType: file.mimeType }];
342 }
343 if (kind === "audio") {
344 return [{ type: "audio", data: file.data, mimeType: file.mimeType }];
345 }
346 if (kind === "text") {
347 return [{ type: "text", text: decodeTextFile(file) }];
348 }
349 return [
350 {
351 type: "resource",
352 resource: {
353 uri: fileResourceUri(file),
354 mimeType: file.mimeType,
355 blob: file.data,
356 },
357 },
358 ];
359};
360
361const toolFileSummaryLine = (file: ToolFileValue, index?: number): string => {
362 const prefix = index === undefined ? "" : `${index + 1}. `;

Callers 1

outputFileContentFunction · 0.85

Calls 3

toolFileKindFunction · 0.85
decodeTextFileFunction · 0.85
fileResourceUriFunction · 0.85

Tested by

no test coverage detected