Skip to main content
Glama

Start or stop an agent session

agent_session
Destructive

Start or stop the executor for one hosted agent session in a project, for a platform whose sessions each bring their own environment. That is OpenAI's Agents API, so the project needs an openai environment connected. Call start right after your app creates the session, with the environment id and remote URL the session returned: the server wakes and the session's tool calls run in the project's folder. The executor stops when you call stop, or after max_minutes. Anthropic sessions need no call: they are picked up on their own.

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>",
      "action": "<action>"
    },
    "name": "agent_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYesstart or stop the session's executor.
project_idYesThe project's id, as returned by create_project or list_projects.
remote_urlNostart only: the remote URL the session returned for its executor to connect to.
max_minutesNostart only: stop the executor after this many minutes. Default 60, at most 360.
environment_idNoThe session's environment id. Required for start; on stop, leave it out to stop every session in the project.

Output Schema

NameRequiredDescriptionDefault
actionYesWhat was asked.
statusYesThe executor is being started or stopped on the server.
project_idYesThe project the session runs in.
max_minutesNoOn start, when the executor stops on its own. null on stop.
environment_idNoThe session's environment id. null when every session in the project is being stopped.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare a destructive, open-world, non-idempotent write, and the description goes further: it explains what the executor does once woken (tool calls run in the project's folder) and that it terminates either on stop or automatically after max_minutes. It also discloses the environment precondition, which no annotation conveys.

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 action and resource, then prerequisites, then call timing, then the timeout, then the alternative path; sentences earn their place. The phrase 'for a platform whose sessions each bring their own environment' is slightly circuitous for what it conveys.

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 explanation, and the description covers prerequisites, timing, and termination conditions for a two-action tool. A small gap remains: it does not say what happens to in-flight tool calls when stop is issued mid-run, which matters given destructiveHint=true.

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%, so each parameter already carries its meaning, including the start-only nature of remote_url and max_minutes and the omission semantics of environment_id on stop. The description restates the start-relevant pairing but adds no format, validation, or edge-case detail beyond the schema.

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 pair (start/stop) applied to a specific resource (the executor for one hosted agent session in a project) and immediately scopes it to a platform class whose sessions bring their own environment. An agent can tell this apart from connect_agent_environment or start_app without opening either 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?

Gives the exact trigger ('Call start right after your app creates the session') along with the arguments to pass, and an explicit when-not case ('Anthropic sessions need no call: they are picked up on their own'). It also names a prerequisite: the project needs an openai environment connected.

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.