Skip to main content
Glama

get-chain-id

Retrieve the current blockchain network identifier to verify the correct chain for secure transactions and interactions.

Instructions

Get the current chain id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get-chain-id' tool. Retrieves the current chain ID using wagmi's getChainId with the configured wagmiConfig and returns it as a text content block.
    execute: async () => { const result = getChainId(wagmiConfig) return { content: [ { type: "text", text: result.toString(), }, ], } },
  • Zod schema defining the input parameters for the 'get-chain-id' tool: an empty object indicating no parameters are required.
    parameters: z.object({}),
  • Local registration function for the 'get-chain-id' tool, exported for use in the main server setup. Includes name, description, schema, and handler.
    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(), }, ], } }, }); };
  • Calls the registerGetChainIdTools function to add the 'get-chain-id' tool to the main FastMCP server instance.
    registerGetChainIdTools(server);

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