Skip to main content
Glama

get_account

get_account

Retrieve account or contract details from the VeChain blockchain using an address, with optional revision specification for historical data.

Instructions

Get information about a VeChain account/contract by address. Optionally specify a revision (best | justified | finalized | block number | block ID).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesAccount/contract address (20-byte hex, with or without 0x prefix)
revisionNoRevision: best | justified | finalized | block number | block ID (hex). If omitted, best is used.best

Implementation Reference

  • The handler function that implements the core logic of the 'get_account' tool. It normalizes the address, constructs the Thorest API URL for /accounts/{address} with optional revision query param, fetches the data with timeout handling, and returns the JSON response or error details.
    callback: async ({ address, revision }: { address: string, revision: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodEnum<[REVISION.Best, REVISION.Justified, REVISION.Finalized]>, z.ZodNumber, z.ZodString]>>> }) => {
        const normalizedAddress = address.startsWith("0x")
            ? address.toLowerCase()
            : `0x${address.toLowerCase()}`;
    
        const base = isMainnet ? vechainConfig.mainnet.thorestApiBaseUrl : vechainConfig.testnet.thorestApiBaseUrl;
        const path = `/accounts/${encodeURIComponent(normalizedAddress)}`;
        const qs = new URLSearchParams();
    
        if (revision !== undefined && revision !== null) {
            qs.set("revision", String(revision));
        }
    
        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: "Account not found (or revision not available)",
                                    address: normalizedAddress,
                                    revision: revision ?? "best",
                                },
                                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 account",
                                reason: String((err as Error)?.message ?? err),
                                url,
                                address: normalizedAddress,
                                revision: revision ?? "best",
                            },
                            null,
                            2
                        ),
                    },
                ],
            };
        } finally {
            clearTimeout(timeout);
        }
    }
  • Zod input schema defining the parameters for the 'get_account' tool: required 'address' (validated VeChain address regex) and optional 'revision' (enum, number, or string with default 'best').
    inputSchema: {
        address: z
            .string()
            .regex(vechainConfig.general.addressRegex, "Invalid address: expected 20-byte hex, optional 0x prefix")
            .describe("Account/contract address (20-byte hex, with or without 0x prefix)"),
        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"),
                ])
                .optional()
                .describe(
                    "Revision: best | justified | finalized | block number | block ID (hex). If omitted, best is used."
                )
                .default("best"),
    },
  • src/tools.ts:78-185 (registration)
    Registration of the 'get_account' tool as an object in the vechainTools array export, defining name, title, description, inputSchema, and callback handler.
    {
        name: "get_account",
        title: "Retrieve account details",
        description: "Get information about a VeChain account/contract by address. Optionally specify a revision (best | justified | finalized | block number | block ID).",
        inputSchema: {
            address: z
                .string()
                .regex(vechainConfig.general.addressRegex, "Invalid address: expected 20-byte hex, optional 0x prefix")
                .describe("Account/contract address (20-byte hex, with or without 0x prefix)"),
            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"),
                    ])
                    .optional()
                    .describe(
                        "Revision: best | justified | finalized | block number | block ID (hex). If omitted, best is used."
                    )
                    .default("best"),
        },
        callback: async ({ address, revision }: { address: string, revision: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodEnum<[REVISION.Best, REVISION.Justified, REVISION.Finalized]>, z.ZodNumber, z.ZodString]>>> }) => {
            const normalizedAddress = address.startsWith("0x")
                ? address.toLowerCase()
                : `0x${address.toLowerCase()}`;
    
            const base = isMainnet ? vechainConfig.mainnet.thorestApiBaseUrl : vechainConfig.testnet.thorestApiBaseUrl;
            const path = `/accounts/${encodeURIComponent(normalizedAddress)}`;
            const qs = new URLSearchParams();
    
            if (revision !== undefined && revision !== null) {
                qs.set("revision", String(revision));
            }
    
            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: "Account not found (or revision not available)",
                                        address: normalizedAddress,
                                        revision: revision ?? "best",
                                    },
                                    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 account",
                                    reason: String((err as Error)?.message ?? err),
                                    url,
                                    address: normalizedAddress,
                                    revision: revision ?? "best",
                                },
                                null,
                                2
                            ),
                        },
                    ],
                };
            } finally {
                clearTimeout(timeout);
            }
        }
    },
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. While it describes the basic read operation, it doesn't mention rate limits, authentication requirements, error conditions, or what specific account information is returned. For a read tool with no annotation coverage, this leaves significant behavioral gaps.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core purpose, and the second sentence efficiently explains the optional parameter. No wasted words or unnecessary elaboration.

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?

For a read tool with no output schema and no annotations, the description is adequate but incomplete. It covers the basic purpose and parameters but doesn't describe what information is returned about the account/contract, which is a significant gap given the lack of output schema.

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%, so the schema already fully documents both parameters. The description adds minimal value beyond the schema by mentioning the revision options and default behavior, but doesn't provide additional semantic context about parameter usage or implications.

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 ('Get information') and target resource ('VeChain account/contract by address'), distinguishing it from sibling tools like get_balance or get_address. It precisely defines what the tool does without being vague or tautological.

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 by mentioning the optional revision parameter, but doesn't explicitly state when to use this tool versus alternatives like get_balance or get_address. It provides some context about the revision parameter but lacks explicit guidance on tool selection among siblings.

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