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

Function renderTool

e2e/scenarios/tool-descriptions.test.ts:232–261  ·  view source on GitHub ↗
(tool: ToolSnapshot)

Source from the content-addressed store, hash-verified

230const codeBlock = (lang: string, body: string): string => `\`\`\`${lang}\n${body}\n\`\`\``;
231
232const renderTool = (tool: ToolSnapshot): string => {
233 const lines: string[] = [`### \`${tool.name}\``, "", `> ${tool.listDescription || "(empty)"}`];
234 if (tool.schemaDescription && tool.schemaDescription !== tool.listDescription) {
235 lines.push("", `tools.schema description differs:`, "", `> ${tool.schemaDescription}`);
236 }
237 if (tool.inputTypeScript) {
238 lines.push("", "**Input**", "", codeBlock("ts", tool.inputTypeScript));
239 }
240 if (tool.outputTypeScript) {
241 lines.push("", "**Output**", "", codeBlock("ts", tool.outputTypeScript));
242 }
243 const definitions = Object.entries(tool.typeScriptDefinitions ?? {});
244 if (definitions.length > 0) {
245 lines.push("", "**Definitions**", "");
246 for (const [name, body] of definitions) {
247 lines.push(codeBlock("ts", `type ${name} = ${body}`));
248 }
249 }
250 if (tool.inputSchema !== undefined) {
251 lines.push(
252 "",
253 "<details><summary>Raw inputSchema</summary>",
254 "",
255 codeBlock("json", JSON.stringify(tool.inputSchema, null, 2)),
256 "",
257 "</details>",
258 );
259 }
260 return lines.join("\n");
261};
262
263scenario(
264 "Tools · agent-visible descriptions snapshot",

Callers

nothing calls this directly

Calls 2

codeBlockFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected