Skip to main content
Glama

system_list_local_keypairs

Retrieve all NEAR accounts and keypairs from the local keystore, optionally filtered by network (testnet or mainnet).

Instructions

List all NEAR accounts and their keypairs in the local keystore by network.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkIdNomainnet

Implementation Reference

  • Registration of the 'system_list_local_keypairs' MCP tool via mcp.tool() with the name 'system_list_local_keypairs', description 'List all NEAR accounts and their keypairs in the local keystore by network.', and a Zod schema requiring an optional 'networkId' parameter (defaults to 'mainnet').
    mcp.tool(
      'system_list_local_keypairs',
      'List all NEAR accounts and their keypairs in the local keystore by network.',
      {
        networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
      },
      async (args, _) => {
        const keyPairs = await keystore.getAccounts(args.networkId);
        const result = {
          networkId: args.networkId,
          keypairs: await Promise.all(
            keyPairs.map(async (accountId) => ({
              accountId,
              publicKey: (await keystore.getKey(args.networkId, accountId))
                .getPublicKey()
                .toString(),
            })),
          ),
        };
        return {
          content: [{ type: 'text', text: stringify_bigint(result) }],
        };
      },
    );
  • Handler function for 'system_list_local_keypairs' that calls keystore.getAccounts(args.networkId), maps over the results to extract accountId and publicKey for each keypair, and returns the data as stringified JSON via the MCP content response.
    mcp.tool(
      'system_list_local_keypairs',
      'List all NEAR accounts and their keypairs in the local keystore by network.',
      {
        networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
      },
      async (args, _) => {
        const keyPairs = await keystore.getAccounts(args.networkId);
        const result = {
          networkId: args.networkId,
          keypairs: await Promise.all(
            keyPairs.map(async (accountId) => ({
              accountId,
              publicKey: (await keystore.getKey(args.networkId, accountId))
                .getPublicKey()
                .toString(),
            })),
          ),
        };
        return {
          content: [{ type: 'text', text: stringify_bigint(result) }],
        };
      },
    );
  • Input schema for 'system_list_local_keypairs' defined with Zod: an optional 'networkId' parameter that is an enum restricted to 'testnet' or 'mainnet', defaulting to 'mainnet'.
    {
      networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
    },
Behavior3/5

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

No annotations provided, but the description discloses reading from local keystore and returning accounts/keypairs. However, it does not mention if any network call is involved or other side effects. Adequate but basic.

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?

Single sentence that is concise and front-loaded with the key action. No wasted words.

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 tool with one optional parameter and no output schema, the description covers the core functionality. It might be improved by noting it operates on the local keystore only, but overall adequate.

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?

The description mentions 'by network' which hints at the networkId parameter, but does not explain its enum values (testnet/mainnet) or default (mainnet). With 0% schema description coverage, the description adds minimal meaning beyond the schema.

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 'List', the resource 'NEAR accounts and their keypairs', and the scope 'local keystore by network'. It distinguishes from sibling tools like account_list_access_keys which list keys for a specific account.

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?

No guidance on when to use this tool versus alternatives such as account_list_access_keys for a single account. No when-not-to or prerequisites 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/nearai/near-mcp'

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