Skip to main content
Glama

memory_session_ensure

One-call session bootstrap: recover the active session or open one.

Replaces the memory_state_get → memory_session_close → memory_session_open → memory_state_set ritual. Reuses the session in the conversation/active-session state pointer when it is still open and owned by the caller; otherwise closes it (distilling) and opens a fresh one, updating state. Returns {session_id, agent, resumed, soul, soul_linked, profile}. When the bearer is linked to a human account, soul is their private compressed identity block for this org (may be empty string if not yet written). profile is the same token-capped bootstrap object as memory_profile_get. When playbook_slug or a work_id with a bound slug resolves, also returns playbook {name, description, body_md, slug} (its cited skills listed by name and when to load them with memory_skill_get, not their bodies; capped) on both fresh and resume paths. Also org + bound (alias session_bound) + bound_scope. bound is the MCP org-session overlay, not GitHub: false on a normal /mcp session still writes to the token's org. On unbound /mcp, a user account with several orgs may include warnings suggesting org_bind(slug=...) (CLI teamshared org bind is optional). Optional auto_recall=true attaches budgeted recall hits (same provenance citation shape as memory_recall) when user= and/or topic= is set (thin-client bootstrap). Prefer an explicit memory_recall for keyword anchors.

Input Schema

NameRequiredDescriptionDefault
ttlNoSession TTL in seconds (default from server config)
repoYesWorkspace slug (absolute path with leading / removed and / replaced by -). Keys the conversation/active-session state pointer.
userNoSubstantive user request for this turn. When set, appended as the user turn in the same call (replaces a separate memory_session_append).
agentNoOverride agent identity
freshNoForce rotation: close any stored session (queueing distillation) and open a new one. Pass true on the first turn of a new chat.
topicNoWhat this session is about (used when opening a new one)
githubNoGitHub owner/repo; distilled memories inherit the tag
work_idNoWork item UUID. When set and playbook_slug is omitted, that item's playbook_slug is injected on the ensure payload.
namespaceNoLimit the attached profile facts/episodes to this org-allowlisted container. Omit for shared-org profile. Invalid/unknown slugs fail.
auto_recallNoOpt-in thin-client bootstrap: when true and user= and/or topic= is set, run a budgeted memory_recall (k=5, explain=false, short deadline) over that text and attach hits as auto_recall. Missing both skips without error. Default false — existing callers are unchanged. Prefer an explicit memory_recall with a short keyword anchor; this is not a replacement.
playbook_slugNoNamed playbook to attach (wins over the work item's slug). Unset/missing/cross-org omits playbook — never dumps the catalog.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / auto_recall
      Added value: +{
      +  "default": false,
      +  "description": "Opt-in thin-client bootstrap: when true and user= and/or topic= is set, run a budgeted memory_recall (k=5, explain=false, short deadline) over that text and attach hits as auto_recall. Missing both skips without error. Default false — existing callers are unchanged. Prefer an explicit memory_recall with a short keyword anchor; this is not a replacement.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / namespace
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Limit the attached profile facts/episodes to this org-allowlisted container. Omit for shared-org profile. Invalid/unknown slugs fail."
      +}
  3. Changed2 schema fields changed
    • addedInput schema / properties / playbook_slug
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Named playbook to attach (wins over the work item's slug). Unset/missing/cross-org omits playbook — never dumps the catalog."
      +}
    • addedInput schema / properties / work_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Work item UUID. When set and playbook_slug is omitted, that item's playbook_slug is injected on the ensure payload."
      +}
  4. First observed

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the whole burden and does: it discloses the destructive side effect ('otherwise closes it (distilling)'), the ownership condition ('still open and owned by the caller'), the state-pointer mutation, and the org-binding subtlety ('``bound`` is the MCP org-session overlay, not GitHub: false on a normal ``/mcp`` session still writes to the token's org'), plus the warnings/org_bind path. This is exactly the behavior an agent cannot infer from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is correctly front-loaded, but the body drifts into dense fragments ('Also ``org`` + ``bound`` (alias ``session_bound``) + ``bound_scope``') and spends several sentences on return-value detail for a tool that has an output schema. The org-binding aside is important but buried mid-paragraph.

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 an 11-parameter, side-effecting bootstrap tool with no annotations and a rich payload, the description covers side effects, ownership, return shape and alternatives. It still omits failure behavior (unknown namespace/repo, TTL expiry) and the cost of triggering distillation, which leaves a small completeness 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 already 100%, so the baseline is 3. The description restates the semantics of auto_recall and playbook_slug/work_id in prose, but that content is duplicated in the schema rather than adding non-obvious meaning (no constraints on ttl, namespace failure modes, or repo key format beyond what the schema says).

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 ('One-call session bootstrap: recover the active session or open one') and explicitly frames itself against the four siblings it replaces (memory_state_get → memory_session_close → memory_session_open → memory_state_set). An agent can distinguish this from memory_session_get/open 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 Guidelines4/5

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

Gives a clear context ('recover the active session or open one') and names the ritual it supersedes, plus a targeted exclusion: 'Prefer an explicit memory_recall for keyword anchors' when auto_recall is tempting. It does not cover the remaining neighbors (memory_session_get, memory_session_append) or when not to bootstrap at all, so it stops short of full when/when-not guidance.

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.