Skip to main content
Glama
AbdelStark
by AbdelStark

get_latest_block

Retrieve the most recent Bitcoin blockchain data to monitor network activity and verify transaction confirmations.

Instructions

Get the latest block

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the get_latest_block tool logic. It calls bitcoinService.getLatestBlock() and formats the response as MCP text content.
    export async function handleGetLatestBlock(bitcoinService: BitcoinService) {
      const block = await bitcoinService.getLatestBlock();
      return {
        content: [
          {
            type: "text",
            text: `Latest block:\nHash: ${block.hash}\nHeight: ${block.height}\nTimestamp: ${block.timestamp}\nTransactions: ${block.txCount}`,
          },
        ] as TextContent[],
      };
    }
  • Registration of the get_latest_block tool in the listTools handler, including name, description, and empty input schema.
    {
      name: "get_latest_block",
      description: "Get the latest block",
      inputSchema: { type: "object", properties: {} },
    } as Tool,
  • Dispatcher case in CallToolRequestHandler that routes get_latest_block calls to the handler function.
    case "get_latest_block": {
      return handleGetLatestBlock(this.bitcoinService);
    }
  • Supporting utility in BitcoinService that fetches the latest block information from Blockstream API.
    async getLatestBlock(): Promise<BlockInfo> {
      try {
        const hashRes = await fetch(`${this.apiBase}/blocks/tip/hash`);
        if (!hashRes.ok) {
          throw new Error("Failed to fetch latest block hash");
        }
        const hash = await hashRes.text();
    
        const blockRes = await fetch(`${this.apiBase}/block/${hash}`);
        if (!blockRes.ok) {
          throw new Error("Failed to fetch block data");
        }
        const block = (await blockRes.json()) as BlockstreamBlock;
    
        return {
          hash: block.id,
          height: block.height,
          timestamp: block.timestamp,
          txCount: block.tx_count,
          size: block.size,
          weight: block.weight,
        };
      } catch (error) {
        logger.error({ error }, "Failed to fetch latest block");
        throw new BitcoinError(
          "Failed to fetch latest block",
          BitcoinErrorCode.BLOCKCHAIN_ERROR
        );
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the action without details on permissions, rate limits, response format, or potential side effects. For a tool with zero annotation coverage, this is insufficient to inform the agent adequately.

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 extremely concise with a single sentence, 'Get the latest block', which is front-loaded and wastes no words. It efficiently conveys the core purpose without unnecessary elaboration.

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 the lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., block data structure, error handling) or provide context for its use among siblings. For a tool with no structured support, more descriptive content is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter information, which is appropriate here, but it could have clarified the lack of parameters explicitly. Baseline is 4 due to the absence of parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get the latest block' clearly states the action (get) and resource (latest block), making the purpose understandable. However, it lacks specificity about what a 'block' refers to in this context (e.g., blockchain block, data block) and does not differentiate from sibling tools like 'get_transaction', leaving room for ambiguity.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any prerequisites, context, or comparisons to sibling tools such as 'get_transaction' or 'decode_tx', leaving the agent without usage instructions.

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

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/AbdelStark/bitcoin-mcp'

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