Skip to main content
Glama

get-block-number

Fetch the most recent blockchain block number to monitor network activity and verify transaction confirmations using MetaMask's secure wallet integration.

Instructions

Fetch the number of the most recent block seen.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdNoID of chain to use when fetching data.

Implementation Reference

  • The handler function that fetches the latest block number using wagmi's getBlockNumber action, optionally for a specific chain, and returns it as a text response.
    execute: async (args) => {
      const chainId = args.chainId as typeof wagmiConfig["chains"][number]["id"];
      const result = await getBlockNumber(wagmiConfig, {
        chainId,
      });
      return {
        content: [
          {
            type: "text",
            text: result.toString(),
          },
        ],
      };
    },
  • Zod schema defining the optional chainId parameter for the tool.
    parameters: z.object({
      chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."),
    }),
  • The registration function for the get-block-number tool, which adds it to the FastMCP server with name, description, schema, and handler.
    export function registerGetBlockNumberTools(server: FastMCP, wagmiConfig: Config): void {
      server.addTool({
        name: "get-block-number",
        description: "Fetch the number of the most recent block seen.",
        parameters: z.object({
          chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."),
        }),
        execute: async (args) => {
          const chainId = args.chainId as typeof wagmiConfig["chains"][number]["id"];
          const result = await getBlockNumber(wagmiConfig, {
            chainId,
          });
          return {
            content: [
              {
                type: "text",
                text: result.toString(),
              },
            ],
          };
        },
      });
    };
  • Call to registerGetBlockNumberTools within the overall registerTools function that sets up all tools.
    registerGetBlockNumberTools(server, wagmiConfig);
  • src/index.ts:15-15 (registration)
    Top-level call to register all tools, including get-block-number, on the MCP server.
    registerTools(server, wagmiConfig);
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. It mentions fetching the 'most recent block seen,' which implies read-only behavior and possibly real-time data, but doesn't clarify latency, error conditions, permissions needed, or if it's cached vs. live. For a tool with no annotations, this leaves significant gaps in understanding its operational traits.

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, clear sentence with zero wasted words—it directly states the tool's function. It's appropriately sized for a simple tool and front-loaded with the essential action, making it efficient and easy to parse.

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 low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate but has clear gaps. It explains the basic purpose but lacks usage guidelines, behavioral details, and output information. For a read operation in a blockchain context, more context on reliability or typical use cases would enhance completeness.

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

Parameters3/5

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

Schema description coverage is 100%, with the single parameter 'chainId' well-documented in the schema as 'ID of chain to use when fetching data.' The description doesn't add any extra meaning about parameters beyond what the schema provides, such as default behavior if omitted or example values. Given high schema coverage, the baseline score of 3 is appropriate.

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 clearly states the action ('Fetch') and the resource ('number of the most recent block seen'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-block' (which retrieves full block data) or 'get-chain-id' (which gets chain identifier), leaving room for improvement in sibling distinction.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't explain if this is for quick status checks versus detailed block analysis (which might use 'get-block'), or mention prerequisites like needing a connected chain. The description only states what it does, not when to choose it.

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/metamask-mcp'

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