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

Function callPingCode

e2e/scenarios/toolkits-mcp.test.ts:104–119  ·  view source on GitHub ↗
(input: {
  readonly integration: string;
  readonly owner: "org" | "user";
  readonly connection: string;
  readonly id: string;
})

Source from the content-addressed store, hash-verified

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected