Skip to main content
Glama

end_session

End active work sessions and record final outcomes. Marks sessions as completed while saving optional summaries of accomplishments, status updates, or abandoned work.

Instructions

End a session and record what was accomplished.

Marks the session as completed and optionally saves a summary. Consider calling promote_session first to save key learnings as permanent memories before ending.

Use this when:

  • Work is finished: end_session("s001", summary="Auth migration complete, all tests passing")

  • Abandoning a session: end_session("s001", summary="Deprioritized — will revisit Q3")

  • Wrapping up for the day with a status update

The session data is retained for 48 hours after completion, then auto-expires. Promoted memories persist forever.

Args: session_id: The session to complete (e.g., "s001"). summary: Optional final summary of the outcome. If omitted, the session closes without a summary. Include what was accomplished and any follow-up items.

Returns: The final session state with status "completed". Returns an error if the session doesn't exist or was already ended.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
summaryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'end_session' tool. Decorated with @mcp.tool() to register it as an MCP tool. It accepts session_id (required) and summary (optional) parameters and delegates the actual execution to the _proxy helper function.
    @mcp.tool()
    async def end_session(session_id: str, summary: Optional[str] = None) -> str:
        """End a session and record what was accomplished.
    
        Marks the session as completed and optionally saves a summary.
        Consider calling `promote_session` first to save key learnings
        as permanent memories before ending.
    
        Use this when:
        - Work is finished: `end_session("s001", summary="Auth migration complete, all tests passing")`
        - Abandoning a session: `end_session("s001", summary="Deprioritized — will revisit Q3")`
        - Wrapping up for the day with a status update
    
        The session data is retained for 48 hours after completion, then
        auto-expires. Promoted memories persist forever.
    
        Args:
            session_id: The session to complete (e.g., "s001").
            summary: Optional final summary of the outcome. If omitted, the session
                closes without a summary. Include what was accomplished and any
                follow-up items.
    
        Returns:
            The final session state with status "completed". Returns an error
            if the session doesn't exist or was already ended.
        """
        return await _proxy("end_session", session_id=session_id, summary=summary)
  • The _proxy helper function that actually executes the tool logic. It makes an authenticated SSE transport call to the remote Astria instance to perform the end_session operation. This is the core execution logic shared by all tools in this MCP server.
    async def _proxy(tool_name: str, **kwargs) -> str:
        """Proxy a tool call to the remote Astria instance."""
        headers = {}
        if API_KEY:
            headers["Authorization"] = f"Bearer {API_KEY}"
    
        try:
            transport = SSETransport(sse_url, headers=headers)
            async with Client(transport) as client:
                result = await client.call_tool(tool_name, kwargs)
                # FastMCP 3.2: result is CallToolResult with .content list
                if hasattr(result, 'content'):
                    parts = result.content
                    if parts and len(parts) > 0:
                        return parts[0].text if hasattr(parts[0], 'text') else str(parts[0])
                # Fallback for older API
                if hasattr(result, 'text'):
                    return result.text
                return str(result)
        except Exception as e:
            return f"Connection error: {e}. Verify your ASTRIA_ENDPOINT and ASTRIA_API_KEY."
Behavior5/5

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

No annotations provided, so description carries full burden. Discloses 48-hour retention policy, auto-expiry behavior, error conditions (session doesn't exist/already ended), and persistence guarantees for promoted memories vs session data.

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?

Appropriately structured with front-loaded purpose, followed by behavioral notes, usage guidelines, and technical specs. Length is justified by zero schema documentation and lack of annotations, though multi-paragraph format is denser than minimal examples.

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?

Despite 0% schema coverage and no annotations, description achieves full coverage: parameter semantics, return value behavior, error states, lifecycle policy (48hr expiry), and sibling interactions. Output schema exists but description still clarifies return value meaning.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage. Description fully compensates with rich semantics: session_id includes format example ('s001'), summary explains optional nature and content guidance ('what was accomplished and any follow-up items').

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?

Opens with specific verb+resource ('End a session and record what was accomplished') and distinguishes from sibling `promote_session` by clarifying that ending marks completion while promotion saves permanent memories.

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?

Explicit 'Use this when:' section with three concrete scenarios (finishing, abandoning, wrapping up) including code examples. Explicitly recommends calling `promote_session` first as an alternative path, creating clear decision boundaries.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PL-ODIN/astria-plugin'

If you have feedback or need assistance with the MCP directory API, please join our Discord server