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
| Name | Required | Description | Default |
|---|---|---|---|
| networkId | No | mainnet |
Implementation Reference
- src/services.ts:461-484 (registration)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) }], }; }, ); - src/services.ts:461-484 (handler)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) }], }; }, ); - src/services.ts:464-466 (schema)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'), },