Skip to main content
Glama

set_api_key

Store your OpenRouter API key in the config file as an alternative to setting an environment variable, so the server can authenticate requests to 200+ models.

Instructions

Store your OpenRouter API key in the config file (alternative to environment variable)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "api_key": "<api_key>"
    },
    "name": "set_api_key"
  }
}

Input Schema

NameRequiredDescriptionDefault
api_keyYesYour OpenRouter API key (starts with sk-or-)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It reveals the write target (config file) but omits critical traits for a credential-storing tool: whether an existing key is overwritten, whether the key is validated, whether it is stored in plaintext, and whether a restart is needed for it to take effect.

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?

One sentence, zero waste, with the action front-loaded and the disambiguating parenthetical placed at the end. Nothing could be removed without losing meaning.

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

Completeness3/5

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

For a one-parameter tool with a fully documented schema and no output schema, the definition is minimally adequate. However, for a secrets-writing tool with zero annotation coverage, the absence of overwrite and security handling detail leaves a meaningful gap.

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?

Schema description coverage is 100% and the single api_key parameter already documents the sk-or- prefix format. The description adds no syntax, format, or validation detail beyond what the schema states, so the baseline 3 applies.

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?

"Store your OpenRouter API key in the config file" gives a specific verb, resource, and destination, and the parenthetical distinguishes it from the environment-variable approach. It does not explicitly differentiate from siblings like get_config or set_default_model, though those are naturally distinct resources.

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

Usage Guidelines3/5

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

The phrase "alternative to environment variable" implies when to reach for this tool (config-file-based credential setup), but there is no explicit when-not guidance, no note about prerequisites such as a valid sk-or- key, and no mention of what happens if a key already exists.

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