Skip to main content
Glama

provider_get_block

Retrieve Ethereum or EVM-compatible blockchain block details by specifying a block hash, number, or tag. Optionally include full transaction data for comprehensive insights.

Instructions

Get a block by number or hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockHashOrBlockTagYesBlock hash or block tag (latest, pending, etc.)
includeTransactionsNoWhether to include full transactions or just hashes

Implementation Reference

  • The handler function that implements the core logic for 'provider_get_block' tool. It uses the provider to fetch the block by hash or tag, optionally including transactions, and returns formatted success or error response.
    export const getBlockHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        if (!input.blockHashOrBlockTag) {
          return createErrorResponse("Block hash or block tag is required");
        }
    
        const provider = getProvider();
        // In ethers.js v5, getBlock can take includeTransactions as a second parameter
        // but TypeScript definitions might not reflect this
        const block = await (provider as any).getBlock(input.blockHashOrBlockTag, input.includeTransactions);
    
        return createSuccessResponse(
        `Block retrieved successfully
          Block hash: ${block.hash}
          Block number: ${block.number?.toString() ?? "Not specified"}
          Block timestamp: ${block.timestamp?.toString() ?? "Not specified"}
          Block transactions: ${block.transactions?.length ?? "Not specified"}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to get block: ${(error as Error).message}`);
      }
    };
  • The schema definition for the 'provider_get_block' tool, specifying input parameters and validation.
    {
      name: "provider_get_block",
      description: "Get a block by number or hash",
      inputSchema: {
        type: "object",
        properties: {
          blockHashOrBlockTag: { type: "string", description: "Block hash or block tag (latest, pending, etc.)" },
          includeTransactions: { type: "boolean", description: "Whether to include full transactions or just hashes" }
        },
        required: ["blockHashOrBlockTag"]
      }
    },
  • src/tools.ts:590-590 (registration)
    The registration of the 'provider_get_block' tool name to its handler function in the handlers dictionary.
    "provider_get_block": getBlockHandler,
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. It states what the tool does but lacks behavioral details: it doesn't mention if this is a read-only operation, potential rate limits, error conditions (e.g., invalid hash), or what the output looks like (e.g., block object structure). For a tool with no annotations, this is a significant gap in transparency.

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 with zero waste. It is front-loaded with the core purpose and uses clear language. Every word earns its place, making it highly concise and well-structured.

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 no annotations and no output schema, the description is incomplete. It doesn't explain return values (e.g., block data format), error handling, or behavioral constraints. For a tool that likely returns complex blockchain data, this leaves the agent with insufficient context to use it effectively.

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%, so the schema fully documents both parameters (blockHashOrBlockTag and includeTransactions). The description adds no additional meaning beyond implying the block identifier can be a number or hash, which is already covered in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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'), specifying it can be retrieved by 'number or hash'. It distinguishes from some siblings like provider_get_transaction (gets transactions) but doesn't explicitly differentiate from network_get_block_number (which gets only the number, not block details). The purpose is specific but sibling differentiation is incomplete.

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 mention when to choose this over network_get_block_number (for block details vs. just number) or provider_get_transaction (for transaction details within a block). The description lacks context about use cases or exclusions.

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

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