Skip to main content
Glama
dofunc
by dofunc

open

Starts, reconnects, or reuses a subagent coding session by session ID or matching working directory, restores its last config, and returns the session ID plus config options.

Instructions

Open a session: reconnect when session is given; with reuse, take this server's idle session with the same cwd and subagent, else reconnect the latest closed one on disk; otherwise create one. A reuse that cannot reconnect creates a new session and says why in reuse_skipped. Reconnecting puts back the config the session last had (the subagent config, or later set_config changes). Returns once the session is set up (role prompt included), with the session id and the full config_options. It takes no task: send tasks with prompt.

Input Schema

NameRequiredDescriptionDefault
cwdYesWorking directory of the agent
roleNoIdentity for the session. Avoid imperative verbs.
reuseNo
sessionNoSession id returned by open
subagentYes

Output Schema

NameRequiredDescriptionDefault
outputNo
reusedYes
statusYes
outcomeNo
sessionYes
turn_idNo
approvalNo
questionNo
reuse_skippedNo
config_optionsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses that creation has an on-disk dimension ('latest closed one on disk'), that reconnect restores prior config (subagent config or later set_config changes), and that a failed reuse silently creates a new session and reports `reuse_skipped`. It stops short of saying whether created sessions need explicit `close`/cleanup or what permissions are required.

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 action, then the mode branches, then the return contract, then the scope exclusion. It is dense but every clause carries information; the semicolon-chained first sentence is the only readability cost.

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?

For a 5-parameter tool with an output schema and no annotations, the description covers the mode logic, side effects, config restoration, failure fallback, and what is returned (session id plus config_options). Only the meaning of `subagent` and the contents/persistence implications of a created session are left unstated.

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 60%, and the description compensates: it defines `reuse` semantics (idle session with same cwd and subagent, else latest closed on disk), clarifies the `session` id came from a prior open, and ties `role` to the role prompt included at setup. `subagent` itself is never explained, leaving one gap.

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+resource ('Open a session') and immediately decomposes it into three distinct modes (reconnect by `session`, reuse idle/latest-closed, fresh create). It also explicitly distinguishes scope from the `prompt` sibling ('It takes no task: send tasks with `prompt`'), so an agent can separate it from the other session tools without opening a 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?

Each parameter combination is mapped to an action: pass `session` -> reconnect, pass `reuse` -> take this server's idle session with matching cwd/subagent else the latest closed one on disk, otherwise create. It also names the follow-up alternative for tasks ('send tasks with `prompt`') and explains the fallback when reuse fails.

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