Skip to main content
Glama

Connect an agent environment

connect_agent_environment
Idempotent

Connect a hosted agent platform's self-hosted environment to a project, so that platform's agent sessions run their tools (shell, files, code) inside the project's folder on this server instead of in the platform's own sandbox. The platforms are Anthropic's Managed Agents (provider anthropic) and OpenAI's Agents API (provider openai). The owner creates the environment and its environment key in the platform's console, and can connect it on the project's page in the dashboard instead. An account API key is refused. anthropic needs environment_id as well: sessions are then picked up on their own, and the server sleeps between them. openai needs only the key: each session brings its own environment, which you start with agent_session. The key is stored encrypted and no tool returns it. Connecting again for the same provider replaces the key.

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": {
      "project_id": "<project_id>",
      "provider": "<provider>",
      "key": "<key>"
    },
    "name": "connect_agent_environment"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYesThe environment key. Write-only: no tool ever returns it.
providerYesThe agent platform: anthropic (Managed Agents) or openai (Agents API).
project_idYesThe project's id, as returned by create_project or list_projects.
environment_idNoanthropic only: the self-hosted environment's id, as its console shows it.

Output Schema

NameRequiredDescriptionDefault
replacedYestrue when it replaced a key already connected for this provider.
environmentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations (readOnly=false, idempotent=true, openWorld=true, destructive=false) are consistent and the description adds substantial context beyond them: the key is stored encrypted and never returned by any tool, account API keys are rejected, reconnecting replaces the existing key, and the sleep-between-sessions behavior for anthropic. These are precisely the operational details an agent cannot infer from structured fields.

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 the core purpose and effect, then provider-specific requirements. Dense but nearly every sentence carries a distinct fact; a couple of longer sentences (the owner/console/dashboard sentence) could be tightened without losing information.

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 4-parameter mutating tool with an output schema, the description covers authorization (account keys refused), storage/security of the secret, idempotent replacement behavior, and post-connect session handling per provider. Nothing an agent needs to call it correctly is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds behavioral meaning beyond the schema: it explains why environment_id is anthropic-only (sessions picked up on their own) versus openai's per-session environment, and confirms the key's write-only nature and replacement-on-reconnect semantics.

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 ('Connect a hosted agent platform's self-hosted environment to a project') and immediately explains the effect on tool execution ('run their tools ... inside the project's folder on this server'). It also names what it is not, contrasting with the dashboard path and the platform's own sandbox, so an agent can distinguish it from disconnect_agent_environment or list_agent_environments.

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?

Gives explicit conditions per provider: anthropic requires environment_id and sessions are picked up automatically with the server sleeping between them; openai needs only the key and each session is started with agent_session. It also says connecting again for the same provider replaces the key, and that the dashboard page is an alternative path, plus that an account API key is refused.

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.