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

Function formatToolCallCode

packages/hosts/mcp/src/tool-call-code.ts:125–133  ·  view source on GitHub ↗
(path: readonly string[], args: unknown)

Source from the content-addressed store, hash-verified

123 * package depends on this one, never the reverse.
124 */
125export const formatToolCallCode = (path: readonly string[], args: unknown): string => {
126 for (const segment of path) {
127 if (!TOOL_PATH_SEGMENT.test(segment)) {
128 // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: unreachable by construction (every segment came from a parsed path or a stored binding); a defect here must not become a malformed emission
129 throw new Error("Invalid resolved tool path.");
130 }
131 }
132 return `return await tools${path.map(formatToolPathSegment).join("")}(${JSON.stringify(args ?? {})})`;
133};

Callers 2

resolveArtifactActionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected