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

Function toolFileContent

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

Source from the content-addressed store, hash-verified

375};
376
377const toolFileContent = (file: ToolFileValue): ContentBlock[] => {
378 const kind = toolFileKind(file);
379 if (kind === "image") {
380 return [{ type: "image", data: file.data, mimeType: file.mimeType }];
381 }
382 if (kind === "audio") {
383 return [{ type: "audio", data: file.data, mimeType: file.mimeType }];
384 }
385 if (kind === "text") {
386 return [{ type: "text", text: decodeTextFile(file) }];
387 }
388 return [
389 {
390 type: "resource",
391 resource: {
392 uri: fileResourceUri(file),
393 mimeType: file.mimeType,
394 blob: file.data,
395 },
396 },
397 ];
398};
399
400const toolFileSummaryLine = (file: ToolFileValue, index?: number): string => {
401 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