Skip to main content
Glama

system_list_local_keypairs

Retrieve and display NEAR accounts and their associated keypairs stored locally for a specified network (testnet or mainnet).

Instructions

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

Input Schema

NameRequiredDescriptionDefault
networkIdNomainnet

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "networkId": { "default": "mainnet", "enum": [ "testnet", "mainnet" ], "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler function that executes the tool logic: fetches accounts from the local keystore and retrieves their public keys for the given network.
    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) }], }; },
  • Zod input schema defining the networkId parameter (testnet or mainnet, defaults to mainnet).
    { networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), },
  • Registration of the tool using mcp.tool(), including name, description, schema, and inline handler.
    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) }], }; }, );

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