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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Get' implies a read-only operation, but it doesn't specify if this requires network connectivity, has latency, returns a numeric or string ID, or if it's cached. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence ('Get the current chain id') that front-loads the core purpose with zero wasted words. Every word earns its place, making it easy for an agent to parse quickly without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks depth. It doesn't explain what a 'chain id' represents in this context (e.g., Ethereum network ID), the return format, or error conditions, which could help an agent use it more effectively despite the low complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter documentation in the description. The baseline for zero parameters is 4, as the description appropriately doesn't waste space on non-existent parameters while remaining clear about the tool's function.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get the current chain id' clearly states the action (Get) and resource (current chain id), making the purpose immediately understandable. However, it doesn't differentiate from siblings like 'get-chains' or 'get-block-number' which might provide related blockchain information, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get-chains' (which might list available chains) or 'get-block-number' (which retrieves a different blockchain property). There's no mention of prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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