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

Function callPingCode

e2e/local/toolkits-mcp.test.ts:108–122  ·  view source on GitHub ↗
(input: {
  readonly integration: string;
  readonly connection: string;
  readonly id: string;
})

Source from the content-addressed store, hash-verified

106 `${integration}.org.${name}.ping.getPing`;
107
108const callPingCode = (input: {
109 readonly integration: string;
110 readonly connection: string;
111 readonly id: string;
112}) => `
113const listed = await tools.search({ namespace: ${JSON.stringify(input.integration)}, query: "ping", limit: 100 });
114const expected = ${JSON.stringify(`${input.integration}.org.${input.connection}.`)};
115const path = listed.items.map((item) => item.path).find((candidate) => candidate.startsWith(expected));
116if (!path) return { ok: false, reason: "missing", expected, paths: listed.items.map((item) => item.path).sort() };
117let tool = tools;
118for (const segment of path.split(".")) tool = tool?.[segment];
119if (typeof tool !== "function") return { ok: false, reason: "not-callable", path };
120const result = await tool({ id: ${JSON.stringify(input.id)} });
121return JSON.stringify({ ok: result.ok, path, data: result.ok ? result.data : result.error });
122`;
123
124const listVisiblePathsCode = (integration: string) => `
125const listed = await tools.search({ namespace: ${JSON.stringify(integration)}, query: "ping", limit: 100 });

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected