Skip to main content
Glama

Zen Session

ultra-session

Manage conversation sessions to maintain persistent context and memory across AI interactions, enabling continuity in multi-turn dialogues.

Instructions

Manage conversation sessions for persistent context and memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
sessionIdNoSession ID (required for get, archive, delete actions)
nameNoSession name (optional for create action)
statusNoSession status filter for list action (default: active)

Implementation Reference

  • Core handler function that implements the ultra-session tool logic, handling create, list, get, archive, and delete actions for conversation sessions using conversationMemory.
    export async function handleSession(args: any) {
      const { action, sessionId, name, status = 'active' } = args;
    
      switch (action) {
        case 'create': {
          const session = await conversationMemory.getOrCreateSession(sessionId, name);
          return {
            content: [
              {
                type: 'text',
                text: `## Session Created\n\nID: ${session.id}\nName: ${session.name || 'Unnamed'}\nStatus: ${session.status}\nCreated: ${session.createdAt}`
              }
            ]
          };
        }
    
        case 'list': {
          const sessionsResult = await conversationMemory.listSessions(status, 20);
          const sessionList = sessionsResult.sessions.map((s: any) => 
            `- **${s.name || s.id}** (${s.id})\n  Messages: ${s.messageCount}, Files: ${s.fileCount}, Tokens: ${s.totalTokens}, Cost: $${s.totalCost.toFixed(4)}\n  Last Activity: ${s.lastActivity.toISOString()}`
          ).join('\n\n');
    
          return {
            content: [
              {
                type: 'text',
                text: `## Sessions (${status})\n\n${sessionList || 'No sessions found.'}`
              }
            ]
          };
        }
    
        case 'get': {
          if (!sessionId) throw new Error('Session ID required for get action');
          const context = await conversationMemory.getConversationContext(sessionId, undefined, true);
          
          return {
            content: [
              {
                type: 'text',
                text: `## Session Details\n\nID: ${sessionId}\nMessages: ${context.messages.length}\nFiles: ${context.files.length}\nTotal Tokens: ${context.totalTokens}\nTotal Cost: $${context.totalCost.toFixed(4)}\n\nBudget:\n- Max Tokens: ${context.budget?.maxTokens || 'None'}\n- Max Cost: $${context.budget?.maxCostUsd || 'None'}\n- Used Tokens: ${context.budget?.usedTokens || 0}\n- Used Cost: $${context.budget?.usedCostUsd || 0}`
              }
            ]
          };
        }
    
        case 'archive':
        case 'delete': {
          if (!sessionId) throw new Error(`Session ID required for ${action} action`);
          await conversationMemory.updateSessionStatus(sessionId, action === 'archive' ? 'archived' : 'deleted');
          
          return {
            content: [
              {
                type: 'text',
                text: `## Session ${action === 'archive' ? 'Archived' : 'Deleted'}\n\nSession ${sessionId} has been ${action === 'archive' ? 'archived' : 'deleted'}.`
              }
            ]
          };
        }
    
        default:
          throw new Error(`Unknown action: ${action}`);
      }
    }
  • Zod schema defining the input parameters for the ultra-session tool: action, sessionId, name, status.
    const ZenSessionSchema = z.object({
      action: z.enum(["create", "list", "get", "archive", "delete"]).describe("Action to perform"),
      sessionId: z.string().optional().describe("Session ID (required for get, archive, delete actions)"),
      name: z.string().optional().describe("Session name (optional for create action)"),
      status: z.enum(["active", "archived", "deleted"]).optional().describe("Session status filter for list action (default: active)"),
    });
  • src/server.ts:986-992 (registration)
    Registers the ultra-session tool with MCP server, providing title, description, input schema, and handler function.
    server.registerTool("ultra-session", {
      title: "Zen Session",
      description: "Manage conversation sessions for persistent context and memory",
      inputSchema: ZenSessionSchema.shape,
    }, async (args) => {
      return await handleSession(args) as any;
    });
Behavior2/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 but offers minimal information. It mentions 'persistent context and memory' which hints at stateful behavior, but doesn't clarify important aspects like whether sessions are user-specific, how long they persist, what permissions are required, or what happens when sessions are archived vs deleted.

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 extremely concise at just 7 words, front-loaded with the core purpose, and contains no wasted language. Every word contributes to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what a 'session' entails, what 'persistent context and memory' means operationally, or what the tool returns. The lack of output schema means the description should ideally provide some indication of return values.

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?

The description provides no parameter-specific information beyond what's already in the schema. However, with 100% schema description coverage and clear enum values for the 'action' and 'status' parameters, the schema does most of the work. The description doesn't add meaningful context about how these parameters interact or what the different actions actually do.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as managing conversation sessions for persistent context and memory, which is a specific verb+resource combination. However, it doesn't differentiate this tool from its many sibling tools on the server, particularly other 'ultra-' prefixed tools that might also manage conversation aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With 25 sibling tools including several 'ultra-' prefixed tools (ultra-analyze, ultra-challenge, ultra-continuation, etc.), there's no indication of how this session management tool relates to or differs from those other tools.

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/RealMikeChong/ultra-mcp'

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