Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-block-txid-by-index

Retrieve a specific transaction ID from a Bitcoin block by providing the block hash and transaction index position.

Instructions

Returns txid for a block at a specific index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe block hash to get txid for
indexYesThe index of the txid in the block

Implementation Reference

  • Core handler implementation that performs the actual API request to retrieve the txid by index using the client.
    async getBlockTxidByIndex({ hash, index }: { hash: string; index: number }): Promise<string | null> {
      return this.client.makeRequest<string>(`block/${hash}/txid/${index}`);
    }
  • Helper wrapper in BlocksService that calls the request service and formats the response text.
    async getBlockTxidByIndex({
      hash,
      index,
    }: {
      hash: string;
      index: number;
    }): Promise<string> {
      const data = await this.requestService.getBlockTxidByIndex({ hash, index });
      return `Block Txid By Index: ${data}`;
    }
  • Zod schema defining the input parameters for the tool: hash (64-char string) and index (integer).
    {
      hash: z.string().length(64).describe("The block hash to get txid for"),
      index: z.number().int().describe("The index of the txid in the block"),
    },
  • Registers the 'get-block-txid-by-index' tool with the MCP server, including description, schema, and thin handler delegating to BlocksService.
    private registerGetBlockTxidByIndexHandler(): void {
      this.server.tool(
        "get-block-txid-by-index",
        "Returns txid for a block at a specific index",
        {
          hash: z.string().length(64).describe("The block hash to get txid for"),
          index: z.number().int().describe("The index of the txid in the block"),
        },
        async ({ hash, index }) => {
          const text = await this.blocksService.getBlockTxidByIndex({ hash, index });
          return { content: [{ type: "text", text }] };
        }
      );
    }

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