system_remove_local_account
Removes a local NEAR account from the local keystore, making it unavailable locally without affecting the account on the blockchain.
Instructions
Removes a local NEAR account from the local keystore. Once removed, the account will no longer be available to the user. This does not delete the account from the NEAR blockchain, it only removes the account from the local keystore.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes | The local account id to remove from the local keystore. | |
| networkId | No | mainnet |
Implementation Reference
- src/services.ts:683-718 (registration)The tool 'system_remove_local_account' is registered using mcp.tool() with the name passed as the first argument. This is both the registration and the handler since mcp.tool() takes the handler as the callback.
mcp.tool( 'system_remove_local_account', noLeadingWhitespace` Removes a local NEAR account from the local keystore. Once removed, the account will no longer be available to the user. This does not delete the account from the NEAR blockchain, it only removes the account from the local keystore.`, { accountId: z .string() .describe('The local account id to remove from the local keystore.'), networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), }, async (args, _) => { const accountRemovalResult: Result<void, Error> = await (async () => { try { await keystore.removeKey(args.networkId, args.accountId); return { ok: true, value: undefined }; } catch (e) { return { ok: false, error: new Error(e as string) }; } })(); if (!accountRemovalResult.ok) { return { content: [ { type: 'text', text: `Error: ${accountRemovalResult.error}`, }, ], }; } return { content: [{ type: 'text', text: `Account removed: ${args.accountId}` }], }; }, ); - src/services.ts:695-717 (handler)The handler function for 'system_remove_local_account' - an async callback that takes args (accountId, networkId) and calls keystore.removeKey() to remove the account from the local keystore.
async (args, _) => { const accountRemovalResult: Result<void, Error> = await (async () => { try { await keystore.removeKey(args.networkId, args.accountId); return { ok: true, value: undefined }; } catch (e) { return { ok: false, error: new Error(e as string) }; } })(); if (!accountRemovalResult.ok) { return { content: [ { type: 'text', text: `Error: ${accountRemovalResult.error}`, }, ], }; } return { content: [{ type: 'text', text: `Account removed: ${args.accountId}` }], }; }, - src/services.ts:689-694 (schema)Input schema for the tool using Zod: accountId (string), networkId (enum of 'testnet'|'mainnet' with default 'mainnet').
{ accountId: z .string() .describe('The local account id to remove from the local keystore.'), networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), },