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 + bound_scope. 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

TableJSON 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

TableJSON 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.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It thoroughly explains side effects: it recovers an existing session if open and owned, otherwise closes it (distilling) and opens a fresh one, updating state. It also details return fields, including playbook, org, bound, and warnings, and describes the auto_recall behavior. Nothing about its mutating nature or side effects is hidden.

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?

The description is dense but every sentence carries information. It front-loads the core purpose, then systematically covers replacement of the ritual, return values, optional behaviors, and parameter nuances. No wasted words; the length is justified by the tool's complexity (11 parameters).

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?

Given the tool's complexity, the description is comprehensive. It covers the return object shape, side effects, usage guidance, alternatives, and optional parameters like auto_recall and playbook_slug. The presence of an output schema further reduces the need to explain return structure, but the description already does. Nothing an agent needs to call this tool 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 schema already documents all parameters. The description adds meaningful usage context beyond the schema: it explains that fresh=true forces rotation for a new chat, that playbook_slug wins over work_id's slug, that auto_recall only runs when user/topic is set, and that repo keys the active-session pointer. This adds value, though the schema already provides baseline definitions.

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?

The description states a specific action: 'One-call session bootstrap: recover the active session or open one.' It clearly names the resource (session) and the operation, and distinguishes itself from sibling tools like memory_session_open and memory_session_close by explicitly replacing a multi-step ritual. It is unambiguous about what the tool does.

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?

The description explicitly explains when to use this tool versus alternatives: it replaces the memory_state_get → memory_session_close → memory_session_open → memory_state_set ritual, and advises preferring an explicit memory_recall for keyword anchors. It also gives concrete guidance like passing fresh=true on the first turn of a new chat, and clarifies that auto_recall is opt-in for thin-client bootstrap, not a replacement for memory_recall.

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.