system_remove_local_account
Remove a local NEAR account from the local keystore to restrict user access, while keeping the account active on the NEAR 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
TableJSON 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:695-717 (handler)Handler function that executes the tool logic: attempts to remove the account key from the local keystore using keystore.removeKey and returns success or error message.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)Zod input schema defining parameters: accountId (string) and networkId (enum testnet/mainnet, default mainnet).{ accountId: z .string() .describe('The local account id to remove from the local keystore.'), networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), },
- src/services.ts:684-718 (registration)MCP server tool registration for 'system_remove_local_account', including description, input schema, and inline handler function.'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}` }], }; }, );