Skip to main content
Glama

account_view_account_summary

Retrieve account summary information on the NEAR blockchain by specifying the account ID and network. This tool queries public RPC endpoints to provide detailed account insights.

Instructions

Get summary information about any NEAR account. This calls a public RPC endpoint to get this information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYes
networkIdNomainnet

Implementation Reference

  • The handler function that implements the core logic of the 'account_view_account_summary' tool. It connects to the NEAR network, retrieves the account details (balance, state, access keys), formats the information, and returns it as a stringified JSON.
      async (args, _) => {
        console.log('args', args);
        const connection = await connect({
          networkId: args.networkId,
          nodeUrl: getEndpointsByNetwork(args.networkId)[0]!,
        });
        const accountResult: Result<Account, Error> = await getAccount(
          args.accountId,
          connection,
        );
        if (!accountResult.ok) {
          return {
            content: [{ type: 'text', text: `Error: ${accountResult.error}` }],
          };
        }
        const account = accountResult.value;
        const balance = await account.getAccountBalance();
        const state = await account.state();
        const accessKeys = await account.getAccessKeys();
        const accountInfo = {
          balance: {
            totalBalance: NearToken.parse_yocto_near(balance.total).as_near(),
            availableBalance: NearToken.parse_yocto_near(
              balance.available,
            ).as_near(),
            stakedBalance: NearToken.parse_yocto_near(balance.staked).as_near(),
          },
          state: {
            blockHeight: state.block_height,
            codeHash: state.code_hash,
            storageUsage: state.storage_usage,
          },
          accessKeys: accessKeys,
        };
        return {
          content: [{ type: 'text', text: stringify_bigint(accountInfo) }],
        };
      },
    );
  • The input schema using Zod for validating parameters: accountId (required string) and networkId (optional enum defaulting to 'mainnet').
      accountId: z.string(),
      networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
    },
  • The MCP tool registration call that defines the tool name, description, input schema, and handler function.
      'account_view_account_summary',
      noLeadingWhitespace`
      Get summary information about any NEAR account. This calls a
      public RPC endpoint to get this information.`,
      {
        accountId: z.string(),
        networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
      },
      async (args, _) => {
        console.log('args', args);
        const connection = await connect({
          networkId: args.networkId,
          nodeUrl: getEndpointsByNetwork(args.networkId)[0]!,
        });
        const accountResult: Result<Account, Error> = await getAccount(
          args.accountId,
          connection,
        );
        if (!accountResult.ok) {
          return {
            content: [{ type: 'text', text: `Error: ${accountResult.error}` }],
          };
        }
        const account = accountResult.value;
        const balance = await account.getAccountBalance();
        const state = await account.state();
        const accessKeys = await account.getAccessKeys();
        const accountInfo = {
          balance: {
            totalBalance: NearToken.parse_yocto_near(balance.total).as_near(),
            availableBalance: NearToken.parse_yocto_near(
              balance.available,
            ).as_near(),
            stakedBalance: NearToken.parse_yocto_near(balance.staked).as_near(),
          },
          state: {
            blockHeight: state.block_height,
            codeHash: state.code_hash,
            storageUsage: state.storage_usage,
          },
          accessKeys: accessKeys,
        };
        return {
          content: [{ type: 'text', text: stringify_bigint(accountInfo) }],
        };
      },
    );
  • Helper function used by the handler to safely retrieve a NEAR Account object, confirming existence by fetching balance.
    const getAccount = async (
      accountId: string,
      connection: Near,
    ): Promise<Result<Account, Error>> => {
      try {
        const account = await connection.account(accountId);
        await account.getAccountBalance();
        return { ok: true, value: account };
      } catch (e) {
        return {
          ok: false,
          error: new Error(
            `Cannot find account by account id ${accountId}: ${e as string}`,
          ),
        };
      }
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses that it calls a public RPC endpoint, suggesting it's a read-only operation without authentication needs. However, it fails to describe key behavioral traits: potential rate limits, error handling (e.g., invalid account IDs), response format, or whether it's safe for frequent use. This leaves significant gaps for an AI agent.

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 appropriately sized and front-loaded: the first sentence states the core purpose, and the second adds technical context. Both sentences earn their place by clarifying the tool's function and implementation method without redundancy or fluff.

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 tool's moderate complexity (2 parameters, no annotations, no output schema), the description is incomplete. It lacks details on return values (e.g., what summary information includes), error cases, and usage context relative to siblings. Without annotations or output schema, the description should provide more behavioral and output guidance to be fully helpful.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'any NEAR account,' hinting at the 'accountId' parameter, but doesn't explain what 'accountId' entails (e.g., format, examples) or the 'networkId' parameter's role (e.g., mainnet vs. testnet implications). With 2 parameters and no schema descriptions, the description adds minimal meaning beyond the bare schema.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get summary information about any NEAR account.' It specifies the verb ('Get') and resource ('NEAR account'), making it understandable. However, it doesn't differentiate from sibling tools like 'account_list_access_keys' or 'account_export_account', which also retrieve account-related data but for different purposes.

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 minimal guidance: it mentions calling a public RPC endpoint, implying it's for read-only summary data. However, it lacks explicit when-to-use instructions, such as distinguishing it from sibling tools (e.g., use this for general account overview vs. 'account_list_access_keys' for key details) or noting prerequisites like needing a valid account ID. No alternatives 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

Related 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/nearai/near-mcp'

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