Skip to main content
Glama

get_block

get_block

Retrieve VeChain blockchain block details by ID, number, or keywords like 'best' to access transaction data and network state.

Instructions

Retrieve information about a VeChain block by its revision (block ID, number, or keywords: best | justified | finalized).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
revisionNoBlock revision: hex ID, block number, or keywords: best | justified | finalizedbest
expandedNoReturn transactions expanded (objects) instead of just IDs (default: false)
rawNoReturn RLP-encoded block instead of structured JSON (default: false)

Implementation Reference

  • The handler function executes the tool logic by constructing the Thorest API URL for the block endpoint, handling query parameters for expanded transactions and raw format, performing the fetch request with timeout and abort control, parsing the JSON response, and returning formatted content or error messages.
    callback: async ({ revision, expanded = false, raw = false }: { revision: z.ZodDefault<z.ZodUnion<[z.ZodEnum<[REVISION.Best, REVISION.Justified, REVISION.Finalized]>, z.ZodNumber, z.ZodString]>>, expanded?: boolean, raw?: boolean }) => {
        const base = isMainnet ? vechainConfig.mainnet.thorestApiBaseUrl : vechainConfig.testnet.thorestApiBaseUrl;
        const path = `/blocks/${encodeURIComponent(String(revision))}`;
        const qs = new URLSearchParams();
    
        if (typeof expanded === "boolean") qs.set("expanded", String(expanded));
        if (typeof raw === "boolean") qs.set("raw", String(raw));
        const url = `${base}${path}${qs.toString() ? `?${qs.toString()}` : ""}`;
    
        const controller = new AbortController();
        const timeout = setTimeout(() => controller.abort(), isMainnet ? vechainConfig.mainnet.controllerAbortTimeout : vechainConfig.testnet.controllerAbortTimeout);
    
        try {
            const res = await fetch(url, { signal: controller.signal });
    
            if (!res.ok) {
                const bodyText = await res.text().catch(() => "");
                throw new Error(
                    `VeChain node responded ${res.status} ${res.statusText}${bodyText ? `: ${bodyText}` : ""
                    }`
                );
            }
    
            const data = await res.json();
    
            if (data == null) {
                return {
                    content: [
                        {
                            type: "text",
                            text: JSON.stringify(
                                {
                                    message: "Block not found",
                                    revision: String(revision),
                                    expanded,
                                    raw,
                                },
                                null,
                                2
                            ),
                        },
                    ],
                };
            }
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(data, null, 2),
                    },
                ],
            };
        } catch (err) {
            const isAbort = (err as Error)?.name === "AbortError";
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(
                            {
                                error: isAbort ? "Request timed out" : "Failed to fetch VeChain block",
                                reason: String((err as Error)?.message ?? err),
                                url,
                            },
                            null,
                            2
                        ),
                    },
                ],
            };
        } finally {
            clearTimeout(timeout);
        }
  • Zod input schema defining parameters: revision (best/justified/finalized, block number, or ID), optional expanded (boolean for full tx objects), optional raw (boolean for RLP hex).
    inputSchema: {
        revision: z
            .union([
                z.enum([REVISION.Best, REVISION.Justified, REVISION.Finalized]),
                z.number().int().nonnegative(),
                z
                    .string()
                    .min(1)
                    .describe("Block ID (hex) or block number as string"),
            ])
            .describe(
                "Block revision: hex ID, block number, or keywords: best | justified | finalized"
            )
            .default("best"),
        expanded: z
            .boolean()
            .optional()
            .describe(
                "Return transactions expanded (objects) instead of just IDs (default: false)"
            ),
        raw: z
            .boolean()
            .optional()
            .describe("Return RLP-encoded block instead of structured JSON (default: false)"),
    },
  • src/server.ts:74-92 (registration)
    Registers the 'get_block' tool (and all vechainTools) with the MCP server using server.registerTool, passing the tool's name, title, description, inputSchema, and a wrapper async handler that calls the tool's callback and standardizes the response content type.
    for (const t of vechainTools) {
      server.registerTool(
        t.name,
        {
          title: t.name,
          description: t.description,
          inputSchema: t.inputSchema
        },
        async (args) => {
          const result = await t.callback(args);
          return {
            content: result.content.map(item => ({
              ...item,
              type: "text" as const
            }))
          };
        }
      );
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions what information is retrieved but doesn't describe response format, error conditions, rate limits, authentication requirements, or whether this is a read-only operation. The description is functional but lacks important operational context.

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 a single, efficient sentence that front-loads the core purpose and immediately clarifies the key parameter. Every word earns its place with no redundancy or 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?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'information about a VeChain block' includes, how the expanded/raw flags affect output, or provide any context about the data structure returned. The agent would need to guess about the response format.

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?

Schema description coverage is 100%, providing comprehensive parameter documentation. The description adds minimal value beyond the schema by mentioning the revision parameter accepts 'block ID, number, or keywords' but doesn't provide additional context about when to use each format or the implications of the expanded/raw flags.

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 specific action ('Retrieve information') and resource ('a VeChain block'), with precise scope details about the revision parameter (block ID, number, or keywords). It distinguishes from sibling tools like get_transaction or get_account by focusing exclusively on block data retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the revision parameter explanation (e.g., 'best | justified | finalized'), but provides no explicit guidance on when to use this tool versus alternatives like get_transaction for transaction details or get_chain for chain-level data. No prerequisites or exclusions are mentioned.

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/leandrogavidia/vechain-mcp-server'

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