Skip to main content
Glama

get_block_count

Retrieve the current block height for a specified Neo N3 network (mainnet or testnet).

Instructions

Get the current block height for the selected network.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork to use: "mainnet" or "testnet"

Implementation Reference

  • The main handler function that executes the get_block_count tool logic. Calls neoService.getBlockCount() and returns blockCount in a success response.
    async function handleGetBlockCount(input: Record<string, unknown>, neoService: NeoService): Promise<unknown> {
      try {
        const count = await neoService.getBlockCount();
        return createSuccessResponse({ blockCount: count });
      } catch (error) {
        return handleError(error);
      }
    }
  • src/index.ts:278-301 (registration)
    Registration of the get_block_count tool using the MCP server's registerTool (server.tool) API. Defines description and input schema with an optional network parameter.
    registerTool(
      'get_block_count',
      'Get the current block height for the selected network.',
      {
        network: z.string().optional().describe('Network to use: "mainnet" or "testnet"'),
      },
      async ({ network }) => {
        const neoService = await this.getNeoService(network as string | undefined);
        const info = await neoService.getBlockchainInfo();
        const result = {
          height: info.height,
          network: neoService.getNetwork()
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • The case statement in the switch that routes the 'get_block_count' tool name to handleGetBlockCount.
    switch (name) {
      case 'get_blockchain_info':
        return await handleGetBlockchainInfo(input, neoService) as Record<string, unknown>;
      case 'get_block_count':
        return await handleGetBlockCount(input, neoService) as Record<string, unknown>;
  • Input schema definition for get_block_count in the tool definitions list. Has an optional 'network' parameter with enum values mainnet/testnet.
    name: 'get_block_count',
    description: 'Get the current block height of the Neo N3 blockchain',
    inputSchema: {
      type: 'object',
      properties: {
        network: {
          type: 'string',
          description: 'Optional: Network to use ("mainnet" or "testnet"). Defaults based on config.',
          enum: [NeoNetwork.MAINNET, NeoNetwork.TESTNET],
        },
      },
      required: [],
    },
  • The NeoService.getBlockCount() helper method that delegates to the RPC client to fetch the current block count/height.
    async getBlockCount(): Promise<number> {
      try {
        return await this.rpcClient.getBlockCount();
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new Error(`Failed to get block count: ${errorMessage}`);
Behavior3/5

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

With no annotations, the description alone must disclose behavior. It correctly indicates a read-only operation but does not mention error handling, result format, or any potential side effects. Minimal but adequate for a simple getter.

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?

A single sentence that is succinct and front-loaded with essential information. Every word contributes to the purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description is minimal. It does not specify the return type or format, which may require the agent to infer. However, for a simple block height query, it is likely sufficient.

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

Parameters3/5

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

The sole parameter 'network' is fully described in the input schema ('mainnet or testnet'). The description adds no extra semantic value beyond what the schema provides. Baseline 3 due to high schema coverage (100%).

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

Purpose5/5

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

The description clearly states the action ('Get'), the resource ('current block height'), and context ('for the selected network'). It effectively distinguishes from sibling tools like 'get_block' which retrieves a specific block.

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?

No guidance is provided on when to use this tool versus its siblings (e.g., 'get_blockchain_info' or 'get_block'). The description lacks any usage context or alternatives.

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/r3e-network/neo-n3-mcp'

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