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

Function uniquePathKey

packages/plugins/google/src/sdk/discovery.ts:408–420  ·  view source on GitHub ↗
(
  paths: Record<string, Record<string, OpenApiOperationObject>>,
  preferredPath: string,
  method: string,
  toolPath: string,
)

Source from the content-addressed store, hash-verified

406 pathTemplate.includes(`{+${parameterName}}`);
407
408const uniquePathKey = (
409 paths: Record<string, Record<string, OpenApiOperationObject>>,
410 preferredPath: string,
411 method: string,
412 toolPath: string,
413): string => {
414 if (!paths[preferredPath]?.[method]) return preferredPath;
415 const disambiguated = `/${toolPath.replace(/[^A-Za-z0-9._~-]+/g, "/")}`;
416 if (!paths[disambiguated]?.[method]) return disambiguated;
417 let index = 2;
418 while (paths[`${disambiguated}/${index}`]?.[method]) index += 1;
419 return `${disambiguated}/${index}`;
420};
421
422const discoveryDescription = (value: unknown): string | undefined =>
423 typeof value === "string"

Callers 1

discovery.tsFile · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected