Skip to main content
Glama

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
NameRequiredDescriptionDefault
methodYesMethod name (e.g., GetAddress)
pathYesPath to the proto file (Full path)
serviceYesService name (e.g., AddressService)

Implementation Reference

  • 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";
            }
        },
    });
  • TypeScript type definition for the output structure returned by the getMethodInformation tool.
        name: string;
        request: string;
        response: string;
        messages: ProtocolBufferMessage[];
        enums: ProtocolBufferEnum[];
    };
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Yuki4-dev/grpc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server