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

Function toolFileContent

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

Source from the content-addressed store, hash-verified

618};
619
620const toolFileContent = (file: ToolFileValue): ContentBlock[] => {
621 const kind = toolFileKind(file);
622 if (kind === "image") {
623 return [{ type: "image", data: file.data, mimeType: file.mimeType }];
624 }
625 if (kind === "audio") {
626 return [{ type: "audio", data: file.data, mimeType: file.mimeType }];
627 }
628 if (kind === "text") {
629 return [{ type: "text", text: decodeTextFile(file) }];
630 }
631 return [
632 {
633 type: "resource",
634 resource: {
635 uri: fileResourceUri(file),
636 mimeType: file.mimeType,
637 blob: file.data,
638 },
639 },
640 ];
641};
642
643const toolFileSummaryLine = (file: ToolFileValue, index?: number): string => {
644 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