Skip to main content
Glama

web3_revoke_key

Revoke an API key using a signed SIWE challenge and the key ID from web3_list_keys.

Instructions

Revoke a specific API key. Requires a fresh SIWE challenge signed with personal_sign. Use web3_list_keys first to get the key_id to revoke.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesThe SIWE message from web3_challenge
signatureYesHex-encoded signature from personal_sign (0x-prefixed, 65 bytes)
key_idYesUUID of the API key to revoke (from web3_list_keys)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesResult data object

Implementation Reference

  • Handler function that executes the web3_revoke_key tool logic. Takes a SIWE message, signature, and key_id as input. Delegates to the SDK's web3.revokeKey method if a client exists, otherwise makes a direct POST to https://api.0xarchive.io/v1/web3/keys/revoke. Returns the API response or an error.
    // Web3 revoke key — works even without API key
    server.registerTool(
      "web3_revoke_key",
      {
        description:
          "Revoke a specific API key. Requires a fresh SIWE challenge signed with personal_sign. " +
          "Use web3_list_keys first to get the key_id to revoke.",
        inputSchema: {
          message: z.string().describe("The SIWE message from web3_challenge"),
          signature: z.string().describe("Hex-encoded signature from personal_sign (0x-prefixed, 65 bytes)"),
          key_id: z.string().describe("UUID of the API key to revoke (from web3_list_keys)"),
        },
        outputSchema: ObjectOutputSchema,
        annotations: AUTH_TOOL_ANNOTATIONS,
      },
      async (params: any) => {
        try {
          if (client) {
            const data = await api().web3.revokeKey(params.message, params.signature, params.key_id);
            return formatResponse(data);
          }
          const response = await fetch("https://api.0xarchive.io/v1/web3/keys/revoke", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ message: params.message, signature: params.signature, key_id: params.key_id }),
          });
          const data = await response.json();
          if (!response.ok) {
            return {
              content: [{ type: "text" as const, text: `Error: ${data.error || "Revoke key failed"}` }],
              isError: true,
            };
          }
          return formatResponse(data);
        } catch (err) {
          const error = err instanceof OxArchiveError ? err : new OxArchiveError(String(err), 500);
          return formatError(error);
        }
      }
    );
  • Input validation schema requiring message (SIWE challenge), signature (personal_sign hex), and key_id (API key UUID). Output schema is the shared ObjectOutputSchema.
    inputSchema: {
      message: z.string().describe("The SIWE message from web3_challenge"),
      signature: z.string().describe("Hex-encoded signature from personal_sign (0x-prefixed, 65 bytes)"),
      key_id: z.string().describe("UUID of the API key to revoke (from web3_list_keys)"),
    },
    outputSchema: ObjectOutputSchema,
    annotations: AUTH_TOOL_ANNOTATIONS,
  • src/index.ts:2196-2234 (registration)
    Registration of the web3_revoke_key tool via server.registerTool with its description, input/output schemas, AUTH_TOOL_ANNOTATIONS (readOnlyHint: false), and handler function.
    server.registerTool(
      "web3_revoke_key",
      {
        description:
          "Revoke a specific API key. Requires a fresh SIWE challenge signed with personal_sign. " +
          "Use web3_list_keys first to get the key_id to revoke.",
        inputSchema: {
          message: z.string().describe("The SIWE message from web3_challenge"),
          signature: z.string().describe("Hex-encoded signature from personal_sign (0x-prefixed, 65 bytes)"),
          key_id: z.string().describe("UUID of the API key to revoke (from web3_list_keys)"),
        },
        outputSchema: ObjectOutputSchema,
        annotations: AUTH_TOOL_ANNOTATIONS,
      },
      async (params: any) => {
        try {
          if (client) {
            const data = await api().web3.revokeKey(params.message, params.signature, params.key_id);
            return formatResponse(data);
          }
          const response = await fetch("https://api.0xarchive.io/v1/web3/keys/revoke", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ message: params.message, signature: params.signature, key_id: params.key_id }),
          });
          const data = await response.json();
          if (!response.ok) {
            return {
              content: [{ type: "text" as const, text: `Error: ${data.error || "Revoke key failed"}` }],
              isError: true,
            };
          }
          return formatResponse(data);
        } catch (err) {
          const error = err instanceof OxArchiveError ? err : new OxArchiveError(String(err), 500);
          return formatError(error);
        }
      }
    );
  • Shared annotations for web3 authentication tools, marking the tool as non-read-only (since it revokes API keys).
    const AUTH_TOOL_ANNOTATIONS = {
      readOnlyHint: false,
      destructiveHint: false,
      idempotentHint: false,
      openWorldHint: true,
    } as const;
  • Shared output schema used by web3_revoke_key for its response format.
    const ObjectOutputSchema: ZodRawShape = {
      data: z.record(z.unknown()).describe("Result data object"),
    };
Behavior2/5

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

Annotations are sparse (readOnlyHint=false, destructiveHint=false, idempotentHint=false). Description does not disclose consequences of revoking (e.g., irreversible, immediate effect, related permissions). With destructiveHint=false but action being destructive, description should clarify; it doesn't. Lacks behavioral context beyond basic action.

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?

Two concise sentences: first states purpose, second gives usage guidance. No redundant words, well-structured.

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

Completeness4/5

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

Output schema exists, so return values are documented. Description covers prerequisites and source of key_id. It could mention that revoking is irreversible or that it invalidates the key immediately, but overall sufficient for a simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema covers all 3 parameters with descriptions (100% coverage). Description reiterates that key_id comes from web3_list_keys, which adds minor context, but does not explain message/signature further. Baseline 3 due to high schema coverage.

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

Purpose5/5

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

Clearly states 'Revoke a specific API key' which is a specific verb and resource. It distinguishes from sibling tools like web3_list_keys (list), web3_challenge (auth), web3_signup, web3_subscribe.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly provides prerequisites: 'Requires a fresh SIWE challenge signed with personal_sign' and 'Use web3_list_keys first to get the key_id'. Clearly tells the user what to do before invoking this tool.

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

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/0xArchiveIO/0xarchive-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server