MCPcopy Create free account
hub / github.com/block/buzz / buildSkillReadContent

Function buildSkillReadContent

desktop/src/features/agents/ui/agentSessionFileRead.ts:25–63  ·  view source on GitHub ↗
(
  item: ToolItem,
  descriptor: AgentActivityDescriptor,
)

Source from the content-addressed store, hash-verified

23};
24
25export function buildSkillReadContent(
26 item: ToolItem,
27 descriptor: AgentActivityDescriptor,
28): FileReadContent | null {
29 if (descriptor.renderClass !== "skill-read") {
30 return null;
31 }
32
33 const skillRef =
34 getToolString(item.args, ["name"]) ??
35 descriptor.preview ??
36 descriptor.object;
37 if (!skillRef) {
38 return null;
39 }
40
41 const resultText = getResultText(item.result);
42 if (!resultText.trim()) {
43 return null;
44 }
45
46 const rawLines = trimTrailingEmptyLines(resultText.split(/\r?\n/));
47 const lines =
48 rawLines.length > 0
49 ? rawLines.map((line) => ({
50 kind: "context" as const,
51 text: line,
52 }))
53 : [{ kind: "meta" as const, text: "No skill content returned." }];
54
55 const footerText = skillRef.includes("/") ? skillRef : `${skillRef}/SKILL.md`;
56
57 return {
58 footerText,
59 footerTitle: skillRef,
60 lines,
61 path: skillRef,
62 };
63}
64
65export function buildFileReadContent(
66 item: ToolItem,

Callers 2

buildCompactToolSummaryFunction · 0.90

Calls 3

getToolStringFunction · 0.90
trimTrailingEmptyLinesFunction · 0.85
getResultTextFunction · 0.70

Tested by

no test coverage detected