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

Function toolFileContent

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

Source from the content-addressed store, hash-verified

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