Skip to main content
Glama

get_self_api_key

Read-only

Get the calling API key's own redacted metadata (id, name, key_prefix, environment, scopes, last_used_at, revoked_at, created_at) for agent self-inspection. Never returns the key hash or full secret. Requires API-key auth — a JWT session has no single-key context (returns 400 api_key_required).

ACCESS: needs a Proof account. Authenticate this client (Claude Code: /mcp → Authenticate), then call this tool again. start_login does NOT open this tool.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_self_api_key"
  }
}

Input Schema

NameRequiredDescriptionDefault

No arguments

Output Schema

NameRequiredDescriptionDefault
idYesMongoDB ObjectId
nameYes
scopesYes
created_atYes
expires_atNoWhen the key stops authenticating; null means it never expires. Enforced at authentication — an expired key is rejected exactly like an unknown one.
key_prefixYes
profile_idNoSub-account (PublicProfile) the key is bound to; null for unbound keys.
revoked_atNoWhen the key was revoked; null while it is live
environmentYes
last_used_atNoWhen the key last authenticated a request; null if never
replaced_key_idsNoIds of the keys this key replaced, newest first: the earlier keys of the same integration, replaced when the key was regenerated (`POST /api/v1/me/api-keys/{id}/regenerate`) or renewed by an MCP sign-in refresh. Requests and usage of those keys count as this key's. Empty when it replaced none. Recorded from the release of key history on; a key replaced before it is not linked.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "description": "An API key's redacted metadata, as the calling key reads itself (`GET /me/api-key`). Never carries the key value.",
      +  "properties": {
      +    "created_at": {
      +      "type": "string"
      +    },
      +    "environment": {
      +      "type": "string"
      +    },
      +    "expires_at": {
      +      "description": "When the key stops authenticating; null means it never expires. Enforced at authentication — an expired key is rejected exactly like an unknown one.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "id": {
      +      "description": "MongoDB ObjectId",
      +      "type": "string"
      +    },
      +    "key_prefix": {
      +      "type": "string"
      +    },
      +    "last_used_at": {
      +      "description": "When the key last authenticated a request; null if never",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "name": {
      +      "type": "string"
      +    },
      +    "profile_id": {
      +      "description": "Sub-account (PublicProfile) the key is bound to; null for unbound keys.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "replaced_key_ids": {
      +      "description": "Ids of the keys this key replaced, newest first: the earlier keys of the same integration, replaced when the key was regenerated (`POST /api/v1/me/api-keys/{id}/regenerate`) or renewed by an MCP sign-in refresh. Requests and usage of those keys count as this key's. Empty when it replaced none. Recorded from the release of key history on; a key replaced before it is not linked.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "revoked_at": {
      +      "description": "When the key was revoked; null while it is live",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "scopes": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "name",
      +    "key_prefix",
      +    "environment",
      +    "scopes",
      +    "created_at"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Beyond readOnlyHint=true, it discloses that the key hash and full secret are never returned, that API-key auth is mandatory, and the exact failure mode (400 api_key_required) for JWT sessions. The ACCESS block adds account prerequisites and the re-authenticate-then-retry flow, which annotations cannot express.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and returned fields are front-loaded, followed by redaction guarantees and then auth constraints — good ordering. The ACCESS paragraph partially repeats the earlier "Requires API-key auth" sentence and its phrasing ("start_login does NOT open this tool") is slightly muddled, costing some tightness.

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?

An output schema exists, so return values need no prose, and the auth/error behavior is covered. The one gap is recovery guidance: it says a JWT session yields 400 but not which tool an agent should call instead, leaving a dead end for that case.

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

Parameters4/5

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

The tool takes no parameters, so the baseline is 4. The description correctly implies the target is implicit (the calling key) rather than passed in, which is the only semantic point that matters here.

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?

The description opens with a specific verb and resource ("Get the calling API key's own redacted metadata") and enumerates the returned fields. It distinguishes itself implicitly from list_api_keys and get_api_key_usage by scoping to the *calling* key and framing it as self-inspection.

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

Usage Guidelines4/5

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

It states the use case ("agent self-inspection") and gives a clear exclusion: a JWT session has no single-key context and gets 400 api_key_required. It does not explicitly name the sibling to use instead when the caller is a JWT session (e.g., get_current_user or list_api_keys), so routing on failure is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.