Skip to main content
Glama

account_list_access_keys

Retrieve all access keys for a specific NEAR account on either testnet or mainnet using the NEAR MCP server. Streamlines account management and permissions auditing.

Instructions

List all access keys for an given account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYes
networkIdNomainnet

Implementation Reference

  • Registration of the MCP tool 'account_list_access_keys'. Includes the tool name, description, input schema (accountId and networkId), and the complete handler function that fetches and returns the account's access keys.
    mcp.tool(
      'account_list_access_keys',
      noLeadingWhitespace`
      List all access keys for an given account.`,
      {
        accountId: z.string(),
        networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
      },
      async (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 accessKeys = await accountResult.value.getAccessKeys();
        return {
          content: [{ type: 'text', text: stringify_bigint(accessKeys) }],
        };
      },
    );
  • The handler function for 'account_list_access_keys' tool. Connects to the specified NEAR network, retrieves the account using getAccount helper, fetches its access keys via account.getAccessKeys(), and returns them as stringified JSON in the MCP response format.
    async (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 accessKeys = await accountResult.value.getAccessKeys();
      return {
        content: [{ type: 'text', text: stringify_bigint(accessKeys) }],
      };
    },
  • Zod input schema for the tool: requires accountId (string), networkId optional enum with default 'mainnet'.
      accountId: z.string(),
      networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
    },
  • Helper function getAccount used by the tool handler to safely retrieve a NEAR Account object, verifying existence by checking 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?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation (implying read-only), but doesn't mention permissions required, rate limits, pagination, response format, or whether it's safe to call. This leaves significant gaps for a tool that accesses sensitive access key data.

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 extremely concise at just one sentence with no wasted words. It's front-loaded with the core purpose and contains no unnecessary information, making it easy to parse quickly.

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 2 parameters (0% schema coverage), no annotations, and no output schema, the description is insufficient. It doesn't explain what access keys are, what format they're returned in, or provide any context about the sensitive nature of listing access keys. The agent would struggle to use this tool correctly.

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 for 2 parameters, the description doesn't compensate at all. It mentions 'account' which relates to 'accountId', but provides no context about what 'accountId' should be, doesn't mention the 'networkId' parameter at all, and gives no guidance on parameter formats or usage.

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 action ('List all access keys') and the target resource ('for an given account'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'account_view_account_summary' or 'system_list_local_keypairs' which might also list account-related information.

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 no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an account ID), exclusions, or comparisons to sibling tools like 'account_view_account_summary' that might provide related information.

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