getMethodInformation
Retrieve detailed information about specific gRPC methods within a proto file by providing the file path, service name, and method name. Ideal for developers debugging or analyzing gRPC services.
Instructions
Get information about methods in a proto file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | Method name (e.g., GetAddress) | |
| path | Yes | Path to the proto file (Full path) | |
| service | Yes | Service name (e.g., AddressService) |
Implementation Reference
- src/loader.ts:46-67 (handler)The core handler function that loads the protobuf definition from the given proto file path, searches for the specified service and method, and returns detailed information including request/response message names, associated messages, and enums.async getMethodAsync(path: string, service: string, method: string): Promise<Method | undefined> { const proto = await protoLoader.loadAsync(path); let result: Method | undefined = undefined; protocolBufferMethodForEach( proto.map((p) => p.protocolBuffer), (p, s, m) => { if (s.name === service && m.name === method) { result = { name: method, request: m.requestMessageName, response: m.responseMessageName, messages: [...p.messages], enums: [...p.enums], }; } return result !== undefined; }, ); return result; },
- src/index.ts:61-78 (registration)Registers the MCP tool 'getMethodInformation' with the FastMCP server, including input schema validation via Zod and a thin execute wrapper that invokes the core handler and handles errors.server.addTool({ name: "getMethodInformation", description: "Get information about methods in a proto file", parameters: z.object({ path: z.string().describe("Path to the proto file (Full path)"), service: z.string().describe("Service name (e.g., AddressService)"), method: z.string().describe("Method name (e.g., GetAddress)"), }), execute: async (args) => { try { const res = await loader.getMethodAsync(args.path, args.service, args.method); return obj2String(res, true); } catch (e) { Logger.error(e); return e instanceof Error ? e.message : "An unknown error occurred"; } }, });
- src/loader.ts:19-24 (schema)TypeScript type definition for the output structure returned by the getMethodInformation tool.name: string; request: string; response: string; messages: ProtocolBufferMessage[]; enums: ProtocolBufferEnum[]; };