Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-block

Retrieve detailed Bitcoin block information by providing the block hash, enabling access to blockchain data for analysis and verification purposes.

Instructions

Returns details about a block from hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe hash info to get block

Implementation Reference

  • Registers the 'get-block' MCP tool, defining its schema (hash: string length 64), description, and handler function that delegates to BlockService.getBlock and returns formatted text content.
    private registerGetRecommendedFeesHandler(): void {
      this.server.tool(
        "get-block",
        "Returns details about a block from hash",
        {
          hash: z.string().length(64).describe("The hash info to get block"),
        },
        async ({ hash }: IHashParameter) => {
          const text = await this.service.getBlock({ hash });
    
          return {
            content: [
              {
                type: "text",
                text: text,
              },
            ],
          };
        }
      );
    }
  • Handler in BlockService that fetches block data from BlockRequestService and formats the response using formatResponse.
    async getBlock({ hash }: IHashParameter): Promise<string> {
      const data = await this.requestService.getBlock({ hash });
      return formatResponse<IBlockResponse>("Details about a block.", data);
    }
  • Core handler in BlockRequestService that performs the API request to retrieve block details using the hash.
    async getBlock({ hash }: IHashParameter): Promise<IBlockResponse | null> {
      return this.client.makeRequest<IBlockResponse>(`block/${hash}`);
    }
  • TypeScript interface defining the input parameter structure for the get-block tool (hash: string). Note: Zod schema in controller adds length(64) validation.
    export interface IHashParameter {
      hash: string;
    }

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/alexandresanlim/mempool-mcp-server'

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