Skip to main content
Glama

Create API Key

create_api_key

Create a new API key in one of your workspaces. Requires admin access in that workspace. The plaintext key is shown exactly once in the response. It is never retrievable again after this call, so save it immediately.

Not available when this MCP connection is itself authenticated with an API key (headless mode): a leaked agent key must not be able to mint more keys. Mint keys from an interactive (OAuth) session or the console instead.

workspace: optional workspace id, workspace name, or org-name/workspace-name when the same name occurs in two of your orgs (defaults to your default; use list_workspaces to discover them). name: a label for the key, shown in the workspace's key list later. scopes: key capabilities. "ingest" (the default) sends telemetry; "read" also lets the key be the Authorization bearer for headless MCP connections; "alerts:manage" creates and configures alert rules; "channels:manage" configures notification destinations. Combine them, e.g. ["ingest", "read"]. expires_in: how long the key lives: "30d" (default), "90d", "1y" or "never". The key outlives this session, so keep it short. A key with alerts:manage or channels:manage cannot be "never" here; an admin issues permanent management keys in the console.

Example:

Create an API key so this agent can send traces.

{ "name": "create_api_key", "arguments": { "name": "my-agent" } }

Give it a key that can also read traces over MCP.

{ "name": "create_api_key", "arguments": { "scopes": ["ingest", "read"] } }

Give a CI job a key that manages alert rules for the next 90 days.

{ "name": "create_api_key",
  "arguments": { "name": "ci-alerts", "scopes": ["alerts:manage"], "expires_in": "90d" } }

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": "create_api_key"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoglassflow-connect-agent
scopesNo
workspaceNo
expires_inNo30d

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / expires_in
      Added value: +{
      +  "default": "30d",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only declare the generic safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false); the description adds the substantive traits: admin access required in the target workspace, the plaintext key is returned exactly once and is unrecoverable afterward, and the operation is blocked entirely in headless/API-key-authenticated sessions. These are exactly the consequences an agent must know before invoking.

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?

Front-loaded with purpose, then the headless-mode restriction, then per-parameter meaning, then worked examples — a sensible order with no filler. It runs long, and the 'shown exactly once / never retrievable / save it immediately' sentence plus three JSON examples overlap somewhat, but the length is defensible for four undocumented parameters.

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?

Covers prerequisites (admin), the blocking condition (headless mode), the security-critical return behavior (one-time plaintext secret), and every parameter including defaults and cross-scope constraints. An output schema exists, so the description need not document the full response shape, and a brief mention of where the key appears is sufficient.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden and does: workspace formats (id, name, org-name/workspace-name) and default behavior, name as a display label, four enumerated scopes with their individual capabilities and a combinable example, and expires_in allowed values plus the constraint that alerts:manage/channels:manage keys cannot be 'never'.

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?

States a specific verb and resource ('Create a new API key') plus the scoping dimension ('in one of your workspaces'), which immediately separates it from sibling read/config tools like list_workspaces and list_users. An agent can tell what the tool produces (a credential) without opening the schema.

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 states a when-not condition: unavailable in headless mode when the MCP connection is authenticated with an API key, with the redirect 'mint keys from an interactive (OAuth) session or the console instead' and the rationale (a leaked agent key must not mint more keys). It also names list_workspaces as the discovery path for the workspace argument.

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.