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.
managed_by_sign_inNoTrue while an MCP sign-in connection holds this key and renews it itself; false for a key a person made and must replace by hand.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / managed_by_sign_in
      Added value: +{
      +  "description": "True while an MCP sign-in connection holds this key and renews it itself; false for a key a person made and must replace by hand.",
      +  "type": "boolean"
      +}
  2. 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"
      +}
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond readOnlyHint=true, the description discloses the security guarantee (never returns the key hash or full secret), the error behavior for JWT auth (400 api_key_required), and that a Proof account plus client authentication is required. These are exactly the behavioral facts an agent cannot infer from annotations or the empty schema.

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 scope are front-loaded in the first clause, and the auth caveats are separated into their own block. The parenthetical field list duplicates what the output schema already provides and the ACCESS paragraph is slightly verbose, but no sentence is wasted.

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

Completeness5/5

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

For a no-argument read tool this covers everything an agent needs: what it returns, what it deliberately withholds, what auth mode is required, and what error to expect otherwise. The output schema means return values needn't be explained, making the extra detail a bonus rather than a gap.

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?

There are zero parameters, so the baseline is 4 and there is nothing for the description to disambiguate. The enumerated return fields are output detail rather than parameter meaning.

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 fields returned. The phrase "self-inspection" and "the calling API key's own" clearly distinguishes it from a general key-listing tool in the sibling set.

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 gives a clear when-to-use signal (agent self-inspection) and an explicit when-not condition (JWT sessions have no single-key context and get 400 api_key_required). It also states the auth prerequisite and onboarding step. It does not name an alternative sibling such as list_api_keys or get_api_key_usage, so it falls short of full routing guidance.

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.