Skip to main content
Glama

account_view_account_summary

Retrieve a summary of any NEAR account's details using a public RPC endpoint.

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 for the 'account_view_account_summary' tool. It connects to NEAR via RPC, retrieves the account, fetches balance, state, and access keys, then returns a summary as 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 tool registration via mcp.tool() with the name 'account_view_account_summary', including its schema (accountId: string, networkId: enum) and description.
    mcp.tool(
      '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) }],
        };
      },
    );
  • Zod input schema for the tool: accountId (string) and networkId (enum: 'testnet' | 'mainnet', default 'mainnet').
    {
      accountId: z.string(),
      networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
    },
Behavior4/5

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

The description discloses that it calls a public RPC endpoint, indicating it is read-only and requires no authentication. No annotations exist, so the description carries full burden; it covers key behavioral traits but omits error handling or rate limits.

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?

Two sentences, each adding value. The description is front-loaded with purpose and avoids redundant or verbose language. Every word earns its place.

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

Completeness4/5

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

For a simple two-parameter tool with no output schema, the description covers the core purpose and the nature of the RPC call. It lacks mention of error scenarios but is otherwise complete.

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?

With 0% schema description coverage, the description must compensate. It clarifies accountId's purpose ('any NEAR account') but does not explain the networkId parameter or its default/options, leaving a gap for the agent.

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 verb 'Get' and resource 'summary information about any NEAR account'. It distinguishes this read-only tool from sibling write operations like account_create_account or account_delete_account.

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 for retrieving account summary but does not explicitly state when to use it over alternatives like contract_view_functions or other account tools. No exclusion criteria are provided.

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

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