Skip to main content
Glama

account_delete_access_keys

Remove an access key from a NEAR blockchain account by specifying the account ID and public key, ensuring secure key management and access control.

Instructions

Delete an access key from an account based on it's public key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYes
networkIdNomainnet
publicKeyYes

Implementation Reference

  • The handler function that executes the deletion of a specific access key from a NEAR account. It connects to the network, fetches the account, verifies the access key exists, and calls account.deleteKey(public_key).
      async (args, _) => {
        const connection = await connect({
          networkId: args.networkId,
          keyStore: keystore,
          nodeUrl: getEndpointsByNetwork(args.networkId)[0]!,
        });
        const accountResult: Result<Account, Error> = await getAccount(
          args.accountId,
          connection,
        );
        if (!accountResult.ok) {
          return {
            content: [{ type: 'text', text: `Error: ${accountResult.error}` }],
          };
        }
        const account = accountResult.value;
        const accessKeys = await account.getAccessKeys();
        const accessKey = accessKeys.find(
          (key) => key.public_key === args.publicKey,
        );
        if (!accessKey) {
          return {
            content: [{ type: 'text', text: 'Access key not found in account' }],
          };
        }
    
        const deleteAccessKeyResult: Result<FinalExecutionOutcome, Error> =
          await (async () => {
            try {
              return {
                ok: true,
                value: await account.deleteKey(accessKey.public_key),
              };
            } catch (e) {
              return { ok: false, error: new Error(e as string) };
            }
          })();
        if (!deleteAccessKeyResult.ok) {
          return {
            content: [
              {
                type: 'text',
                text: `Error: ${deleteAccessKeyResult.error}\n\nFailed to delete access key ${args.publicKey} from account ${args.accountId}`,
              },
            ],
          };
        }
        return {
          content: [
            {
              type: 'text',
              text: `Access key deleted: ${args.publicKey}`,
            },
          ],
        };
      },
    );
  • Input schema validation using Zod for the tool parameters: accountId, networkId (default 'mainnet'), and publicKey.
      accountId: z.string(),
      networkId: z.enum(['testnet', 'mainnet']).default('mainnet'),
      publicKey: z.string(),
    },
  • Registration of the 'account_delete_access_keys' tool in the MCP server using mcp.tool().
    mcp.tool(
      'account_delete_access_keys',
      noLeadingWhitespace`
      Delete an access key from an account based on it's public key.`,
      {
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a deletion operation, implying it's destructive and likely irreversible, but doesn't disclose critical behavioral traits such as required permissions (e.g., admin access), side effects (e.g., impact on account functionality), error handling (e.g., what happens if the key doesn't exist), or rate limits. For a destructive tool with zero annotation coverage, this is a significant gap.

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?

The description is a single, direct sentence with zero waste—it states the action, target, and key input concisely. It's front-loaded with the core purpose, making it easy to parse quickly without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a destructive operation with 3 parameters), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., permissions, consequences), parameter usage, and expected outcomes. For a tool that modifies account security, this leaves significant gaps for an AI agent to use it correctly and safely.

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?

Schema description coverage is 0%, so the description must compensate. It mentions 'public key' as the basis for deletion, which aligns with one parameter, but doesn't explain the other two parameters ('accountId' and 'networkId') or their relationships (e.g., that 'networkId' defaults to 'mainnet'). With 3 parameters and low coverage, the description adds minimal value beyond what's inferable from the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and target resource ('an access key from an account'), specifying it's based on the public key. It distinguishes from siblings like 'account_list_access_keys' (list vs delete) and 'account_delete_account' (delete key vs delete entire account). However, it doesn't explicitly mention the network context, which is relevant given the 'networkId' parameter.

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 is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing the account ID and public key), when not to use it (e.g., for read-only operations), or refer to sibling tools like 'account_list_access_keys' for verification before deletion. The description is purely functional without contextual advice.

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

Related 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