Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-block-txs

Retrieve Bitcoin block transactions by providing a specific block hash to access transaction data from the blockchain.

Instructions

Returns transactions for a block

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe block hash to get txs for

Implementation Reference

  • Core implementation of fetching block transactions via API request to endpoint `block/${hash}/txs` using the API client.
    async getBlockTxs({ hash }: { hash: string }): Promise<IBlockTxsResponse[] | null> {
      return this.client.makeRequest<IBlockTxsResponse[]>(`block/${hash}/txs`);
    }
  • Service layer handler that retrieves block transactions from request service and formats the response using formatResponse.
    async getBlockTxs({ hash }: IHashParameter): Promise<string> {
      const data = await this.requestService.getBlockTxs({ hash });
      return formatResponse<IBlockTxsResponse[]>("Block Txs", data);
    }
  • Registers the "get-block-txs" MCP tool, defines input schema (hash: 64-char string), and provides thin handler that delegates to BlocksService.getBlockTxs and returns MCP-formatted response.
    private registerGetBlockTxsHandler(): void {
      this.server.tool(
        "get-block-txs",
        "Returns transactions for a block",
        {
          hash: z.string().length(64).describe("The block hash to get txs for"),
        },
        async ({ hash }) => {
          const text = await this.blocksService.getBlockTxs({ hash });
          return { content: [{ type: "text", text }] };
        }
      );
  • TypeScript interface defining the expected structure of individual block transaction responses (output schema).
    export interface IBlockTxsResponse {
      txid: string;
      status: {
        confirmed: boolean;
        block_height?: number;
        block_hash?: string;
        block_time?: number;
      };
      vin: any[];
      vout: any[];
    }

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