Skip to main content
Glama

mavis_session_rotate

Archive the current session and create a new one with a handoff prompt to reset context and continue fresh.

Instructions

Rotate the current session — archives the old session and creates a fresh one with a handoff prompt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.js:172-177 (registration)
    Tool registration for 'mavis_session_rotate' in the tools array. It has no execFn (defaults to execMavisJSON) and no outputMode (defaults to JSON output). Its buildArgs builds ['session', 'rotate']. Input schema is empty (no params needed).
    {
      name: 'mavis_session_rotate',
      description: 'Rotate the current session — archives the old session and creates a fresh one with a handoff prompt.',
      inputSchema: z.object({}),
      buildArgs: () => ['session', 'rotate']
    },
  • Input schema for mavis_session_rotate: an empty zod object (z.object({})), meaning no arguments are accepted.
    inputSchema: z.object({}),
  • The runTool function that handles execution of all tools including mavis_session_rotate. Since mavis_session_rotate has no execFn, it falls through to execMavisJSON, which calls execMavis and parses JSON output.
    function runTool(spec, parsedArgs) {
      const { execFn, outputMode, stdin, buildArgs } = spec;
      const args = buildArgs(parsedArgs);
      const input = typeof stdin === 'function' ? stdin(parsedArgs) : stdin;
    
      const execPromise = execFn
        ? execMavis(args, input || '')
        : execMavisJSON(args);
    
      return execPromise.then(result => {
        const text = outputMode === OUTPUT_RAW
          ? (result || '')
          : JSON.stringify(result, null, 2);
        return [{ type: 'text', text }];
      });
    }
  • The execMavis helper function that spawns the Mavis CLI binary and runs the command. For mavis_session_rotate, buildArgs returns ['session', 'rotate'], which execMavis executes via child_process.spawn.
    function execMavis(args, input = '') {
      return new Promise((resolve, reject) => {
        const SESSION_COMMANDS = new Set(['communication', 'session', 'spawn']);
        const sessionId = process.env.__MAVIS_PARENT_SESSION_ID;
        const subcmd = args[0];
        const needsSession = SESSION_COMMANDS.has(subcmd) && sessionId;
        const finalArgs = needsSession ? [...args, '--session', sessionId] : args;
        const proc = spawn(MAVIS_BIN, finalArgs, { stdio: ['pipe', 'pipe', 'pipe'] });
        let stdout = '';
        let stderr = '';
    
        proc.stdout.on('data', d => stdout += d.toString());
        proc.stderr.on('data', d => stderr += d.toString());
        proc.on('close', code => {
          if (code === 0) resolve(stdout.trim());
          else reject(new Error(stderr.split('\n')[0] || `exit code ${code}`));
        });
        proc.on('error', reject);
    
        if (input) proc.stdin.write(input), proc.stdin.end();
      });
    }
Behavior3/5

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

With no annotations, the description carries the burden. It discloses archiving and creation of a fresh session with handoff, but does not explain side effects like whether the archived session is retrievable or details about the handoff prompt.

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 a single concise sentence that front-loads the key action and outcome, with no wasted words.

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 a simple tool with no parameters and no output schema, the description provides sufficient context: what it does and the result. Minor omission is the fate of the archived session, but overall complete enough.

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?

The input schema has no parameters, so the description naturally adds meaning beyond the empty schema by explaining the tool's action. Baseline is 4 for zero parameters, and description meets expectations.

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 clearly states the verb 'Rotate' and the resource 'current session', and explains the outcome: archive old session and create fresh one with handoff. It effectively distinguishes from sibling session tools like mavis_session_new and mavis_session_abort.

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

Usage Guidelines3/5

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

The description implies usage context (rotate current session) but does not explicitly state when to use it versus alternatives like mavis_session_new or mavis_session_abort. No exclusions or when-not-to-use guidance.

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/Cunning-Kang/mavis-mcp-server'

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