Skip to main content
Glama
alexandresanlim

Mempool MCP Server

get-block-txid-by-index

Retrieve the transaction ID (txid) from a specific block by providing the block hash and the transaction index within the block. Ideal for accessing precise Bitcoin blockchain data.

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

  • Registration of the MCP tool 'get-block-txid-by-index' including name, description, input schema, and handler function.
    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 }] }; } );
  • The handler function that executes the tool's core logic: calls BlocksService and formats the response as MCP content.
    async ({ hash, index }) => { const text = await this.blocksService.getBlockTxidByIndex({ hash, index }); return { content: [{ type: "text", text }] }; }
  • Zod schema defining input parameters: hash (string length 64) 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"), },
  • Application service method that delegates to infrastructure request service and formats the txid response.
    async getBlockTxidByIndex({ hash, index, }: { hash: string; index: number; }): Promise<string> { const data = await this.requestService.getBlockTxidByIndex({ hash, index }); return `Block Txid By Index: ${data}`; }
  • Infrastructure service method implementing the API request to fetch txid by index for a block.
    async getBlockTxidByIndex({ hash, index }: { hash: string; index: number }): Promise<string | null> { return this.client.makeRequest<string>(`block/${hash}/txid/${index}`); }

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