Skip to main content
Glama

get-chain-id

Retrieve the current chain ID from a blockchain network using MCPilot. Facilitates secure interactions with MetaMask, enabling AI-powered blockchain tasks without exposing private keys.

Instructions

Get the current chain id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that retrieves the current chain ID using Wagmi's getChainId(wagmiConfig) and formats it as a text content response for MCP.
    execute: async () => { const result = getChainId(wagmiConfig) return { content: [ { type: "text", text: result.toString(), }, ], } },
  • Tool metadata including name, description, and Zod schema for parameters (no parameters required).
    name: "get-chain-id", description: "Get the current chain id", parameters: z.object({}),
  • Top-level registration call that invokes the tool registration function on the FastMCP server instance.
    registerGetChainIdTools(server);
  • Dedicated registration function that adds the get-chain-id tool to the server, including handler and schema.
    export function registerGetChainIdTools(server: FastMCP): void { server.addTool({ name: "get-chain-id", description: "Get the current chain id", parameters: z.object({}), execute: async () => { const result = getChainId(wagmiConfig) return { content: [ { type: "text", text: result.toString(), }, ], } }, }); };

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/Xiawpohr/mcpilot'

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