Skip to main content
Glama
monad-vibe

Monad MCP Server

by monad-vibe

get-block-by-number

Retrieve specific block details by providing the block number on the Monad testnet using the Monad MCP Server. Simplify interactions with blockchain data for AI models and development workflows.

Instructions

Get a block by number on Monad testnet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYesThe block number to retrieve

Implementation Reference

  • The handler function that retrieves the block by number using publicClient.getBlock, formats key block details into a text response, and handles errors.
    async (args) => {
        try {
            const block = await publicClient.getBlock({ blockNumber: BigInt(args.number) });
            return {
                content: [
                    {
                        type: "text",
                        text: `Block Number: ${block.number}
                            Hash: ${block.hash}
                            Timestamp: ${block.timestamp}
                            Transaction Count: ${block.transactions.length}
                            Parent Hash: ${block.parentHash}
                            Gas Used: ${block.gasUsed}
                            Gas Limit: ${block.gasLimit}`,
                    },
                ],
            };
        } catch (error) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to retrieve the block. Error: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
            };
        }
    }
  • Input schema defining the 'number' parameter as a string using Zod.
    { "number": z.string().describe("The block number to retrieve"), },
  • The provider function that registers the 'get-block-by-number' tool on the MCP server, including name, description, schema, and handler.
    export function getBlockByNumberProvider(server: McpServer) {
        server.tool(
            "get-block-by-number",
            "Get a block by number on Monad testnet",
            { "number": z.string().describe("The block number to retrieve"), },
            async (args) => {
                try {
                    const block = await publicClient.getBlock({ blockNumber: BigInt(args.number) });
                    return {
                        content: [
                            {
                                type: "text",
                                text: `Block Number: ${block.number}
                                    Hash: ${block.hash}
                                    Timestamp: ${block.timestamp}
                                    Transaction Count: ${block.transactions.length}
                                    Parent Hash: ${block.parentHash}
                                    Gas Used: ${block.gasUsed}
                                    Gas Limit: ${block.gasLimit}`,
                            },
                        ],
                    };
                } catch (error) {
                    return {
                        content: [
                            {
                                type: "text",
                                text: `Failed to retrieve the block. Error: ${error instanceof Error ? error.message : String(error)}`,
                            },
                        ],
                    };
                }
            }
        );
    }
  • Intermediate registration function that invokes the getBlockByNumberProvider among other block tools.
    export function blockProvider(server: McpServer) {
        getLatestBlockProvider(server);
        getBlockByNumberProvider(server);
    }
  • src/index.ts:27-27 (registration)
    Top-level call to register all block tools, including 'get-block-by-number', during server initialization.
    blockProvider(server);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves a block but omits critical details such as whether it's a read-only operation (implied by 'Get'), error handling for invalid block numbers, rate limits, or authentication needs. 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 that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence contributes essential information, earning its place with zero waste.

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

Completeness2/5

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

Given the complexity of blockchain operations, no annotations, and no output schema, the description is incomplete. It lacks details on return values (e.g., block structure), error cases, network-specific behaviors, or how it fits within the sibling toolset. For a tool with such sparse structured data, more context is needed to be fully helpful.

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?

The input schema has 100% description coverage, with the 'number' parameter documented as 'The block number to retrieve'. The description adds no additional meaning beyond this, such as format details (e.g., integer vs. hex) or constraints. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema handles the parameter documentation adequately.

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 ('Get') and resource ('a block by number'), specifying the target network ('on Monad testnet'). It distinguishes from siblings like 'get-latest-block' by focusing on specific block numbers rather than the latest. However, it doesn't explicitly contrast with all siblings, such as 'query-mon-nft' or 'watch-contract-events', which is why it's a 4 rather than a 5.

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 minimal guidance, implying usage when a specific block number is known on the Monad testnet. It lacks explicit when-to-use scenarios, alternatives (e.g., using 'get-latest-block' for recent blocks), or exclusions (e.g., not for querying NFTs). No context on prerequisites or limitations is given, making it basic but not entirely absent.

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

Related 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/monad-vibe/monad-mcp-server'

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