Skip to content
Docs menu

Tool reference · Sessions & episodes

session_end

Saves a structured end-of-session summary (what was done, pitfalls, next steps) that the next session_init call will return.

local stdio server writes
Caution. summary is required unless auto_compress is true. auto_compress needs a working LLM provider; if it is unavailable the call still saves, with auto_compress_error set.

When to use

  • You are about to finish a session and want the next one to resume cleanly.
  • You want to record open questions and gotchas before context is lost.
  • You have no written summary and want an LLM to draft one from the session log (auto_compress: true).

Parameters

NameTypeDefaultDescription
session_idrequired string — —
summary string — —
highlights string[] — —
pitfalls string[] — —
next_steps string[] — —
open_questions string[] — —
project string "general" —
auto_compress boolean false —
transcript string — —

Example

Arguments

{
  "session_id": "sess-2026-09-24-a",
  "project": "my-api",
  "summary": "Moved JWT validation into middleware and fixed refresh-token expiry.",
  "pitfalls": [
    "Refresh tokens are stored in UTC; do not compare with local time"
  ],
  "next_steps": [
    "Add rate limiting to /auth/refresh"
  ]
}

Result shape

{
  "id": "9f1c2a7e4b0d4c1f8e2a6b3c5d7e9f01",
  "session_id": "sess-2026-09-24-a",
  "project": "my-api",
  "ended_at": "2026-09-24T18:02:11Z",
  "summary_len": 68,
  "next_steps_count": 1
}

With auto_compress the result also has auto_compress, compressed_used and, on failure, auto_compress_error.

Values are illustrative; the keys follow the server's handler. MCP clients receive the result as JSON text content.

Server description

The description the server sends to your agent in tools/list, captured from the v14.7.0 source:

End-of-session capture: summary + highlights + pitfalls + next_steps so the next session can resume cleanly. Set auto_compress=true to have the LLM generate the missing summary/next_steps/pitfalls from stored session artifacts (or from an optional `transcript`).

Found a mistake? Open an issue on GitHub.

Search