Skip to main content
Glama

eth_blockNumber

Get the current block number from any EVM-compatible blockchain to track network progress and synchronize with the latest state.

Instructions

Returns the number of the most recent block

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the eth_blockNumber tool. It makes an RPC call to get the latest block number in hex, parses it to decimal, adds a timestamp, and formats the response using formatResponse.
    async () => {
      try {
        const result = await makeRPCCall("eth_blockNumber");
        const blockNumber = parseInt(result, 16);
        return {
          content: [
            {
              type: "text",
              text: formatResponse(
                {
                  hex: result,
                  decimal: blockNumber,
                  timestamp: new Date().toISOString(),
                },
                "Latest Block Number",
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${error.message}`,
            },
          ],
        };
      }
  • Empty schema indicating no input parameters are required for the tool.
    {},
  • src/index.ts:158-192 (registration)
    Registration of the eth_blockNumber tool using McpServer's server.tool method, specifying name, description, schema, and handler.
    server.tool(
      "eth_blockNumber",
      "Returns the number of the most recent block",
      {},
      async () => {
        try {
          const result = await makeRPCCall("eth_blockNumber");
          const blockNumber = parseInt(result, 16);
          return {
            content: [
              {
                type: "text",
                text: formatResponse(
                  {
                    hex: result,
                    decimal: blockNumber,
                    timestamp: new Date().toISOString(),
                  },
                  "Latest Block Number",
                ),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
      },
    );
  • Helper function makeRPCCall used by the handler to send the RPC request to the Ethereum provider.
    async function makeRPCCall(method: string, params: any[] = []): Promise<any> {
      try {
        const result = await provider.send(method, params);
        return result;
      } catch (error: any) {
        throw new Error(`RPC call failed: ${error.message}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the return value but lacks information about potential errors, rate limits, network dependencies, or whether this is a read-only operation (though implied by 'Returns'). More behavioral context would be helpful given the absence of annotations.

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 that directly states the tool's function without any wasted words. It's perfectly front-loaded and appropriately sized for a simple query tool with no parameters.

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 completeness. It doesn't specify the return format (e.g., hex string, integer), potential errors, or blockchain context needed for proper use. More contextual information would improve agent understanding.

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 with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose. Baseline for 0 parameters is 4, as no parameter explanation is needed.

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

Purpose5/5

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

The description clearly states the specific action ('Returns') and resource ('the number of the most recent block'), distinguishing it from siblings like eth_getBlockByNumber (which returns full block details) or eth_chainId (which returns chain identifier). It precisely communicates what the tool does without redundancy.

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

Usage Guidelines3/5

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

The description implies usage for retrieving the latest block number, but provides no explicit guidance on when to use this versus alternatives like eth_getBlockByNumber (for detailed block data) or other blockchain query tools. Usage context is implied rather than stated, leaving some ambiguity.

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/JamesANZ/evm-mcp'

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