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

Function toolFileContent

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

Source from the content-addressed store, hash-verified

520};
521
522const toolFileContent = (file: ToolFileValue): ContentBlock[] => {
523 const kind = toolFileKind(file);
524 if (kind === "image") {
525 return [{ type: "image", data: file.data, mimeType: file.mimeType }];
526 }
527 if (kind === "audio") {
528 return [{ type: "audio", data: file.data, mimeType: file.mimeType }];
529 }
530 if (kind === "text") {
531 return [{ type: "text", text: decodeTextFile(file) }];
532 }
533 return [
534 {
535 type: "resource",
536 resource: {
537 uri: fileResourceUri(file),
538 mimeType: file.mimeType,
539 blob: file.data,
540 },
541 },
542 ];
543};
544
545const toolFileSummaryLine = (file: ToolFileValue, index?: number): string => {
546 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