MCPcopy Index your code
hub / github.com/github/copilot-sdk / getMethodParamsInfo

Function getMethodParamsInfo

scripts/codegen/rust.ts:1706–1729  ·  view source on GitHub ↗

* Determine if a method has typed params. Returns `{ hasParams, typeName }`. * Handles `$ref`-based, title-bearing, and inline params uniformly: * * - Resolves `$ref` to its definition. * - For session methods, ignores `sessionId` (the namespace injects it). * - Returns `hasParams=false`

(
	method: RpcMethod,
	defCollections: DefinitionCollections,
	isSession: boolean,
)

Source from the content-addressed store, hash-verified

1704 * definition's `title`, then the inline params `title`.
1705 */
1706function getMethodParamsInfo(
1707 method: RpcMethod,
1708 defCollections: DefinitionCollections,
1709 isSession: boolean,
1710): { hasParams: boolean; optional: boolean; typeName: string | null } {
1711 if (!method.params) return { hasParams: false, optional: false, typeName: null };
1712 const paramsSchema = getMethodParamsObjectSchema(
1713 method,
1714 defCollections,
1715 isSession,
1716 );
1717 if (!paramsSchema) return { hasParams: false, optional: false, typeName: null };
1718
1719 const typeName = rustParamsTypeName(method, defCollections);
1720
1721 const props = Object.keys(paramsSchema.properties || {});
1722 if (props.length === 0) return { hasParams: false, optional: false, typeName: null };
1723 if (!typeName) return { hasParams: false, optional: false, typeName: null };
1724 const required = new Set(paramsSchema.required || []);
1725 const hasRequiredParams = props.some((p) => required.has(p));
1726 const optional = isNullableParamsSchema(method.params, defCollections) &&
1727 !hasRequiredParams;
1728 return { hasParams: true, optional, typeName };
1729}
1730
1731function rpcMethodConstName(method: RpcMethod): string {
1732 return method.rpcMethod.replace(/\./g, "_").toUpperCase();

Callers 1

emitNamespaceMethodFunction · 0.85

Calls 3

rustParamsTypeNameFunction · 0.85
isNullableParamsSchemaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…