Skip to main content
Glama

mavis_memory_append

Append new entries to Mavis memory at user, agent, or project scope with content and optional topic label.

Instructions

Append a new entry to Mavis memory (user, agent, or project level).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeYesMemory scope
agentNameNoAgent name (required when scope=agent)
contentYesContent to append
topicNoTopic label for the entry

Implementation Reference

  • src/index.js:262-282 (registration)
    Tool registration for 'mavis_memory_append' in the tools array. Defines name, description, inputSchema, execFn, outputMode, stdin, and buildArgs.
    {
      name: 'mavis_memory_append',
      description: 'Append a new entry to Mavis memory (user, agent, or project level).',
      inputSchema: z.object({
        scope: z.enum(['user', 'agent', 'project']).describe('Memory scope'),
        agentName: z.string().optional().describe('Agent name (required when scope=agent)'),
        content: z.string().describe('Content to append'),
        topic: z.string().optional().describe('Topic label for the entry')
      }),
      execFn: execMavis,
      outputMode: OUTPUT_RAW,
      stdin: ({ topic, content }) => topic
        ? `### ${topic} (${new Date().toISOString().split('T')[0]})\n${content}`
        : content,
      buildArgs: ({ scope, agentName }) => {
        const args = ['memory', 'append'];
        if (scope !== 'user') args.push(scope);
        if (agentName) args.push(agentName);
        return args;
      }
    },
  • Input schema for mavis_memory_append: scope (enum: user/agent/project), agentName (optional, required when scope=agent), content (string), topic (optional string).
    inputSchema: z.object({
      scope: z.enum(['user', 'agent', 'project']).describe('Memory scope'),
      agentName: z.string().optional().describe('Agent name (required when scope=agent)'),
      content: z.string().describe('Content to append'),
      topic: z.string().optional().describe('Topic label for the entry')
    }),
  • runTool is the generic handler that executes all tools. For mavis_memory_append (which has execFn=execMavis and outputMode=OUTPUT_RAW), it calls execMavis with the args from buildArgs and the stdin string, then returns the raw result as text content.
    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 }];
      });
    }
  • execMavis helper function that spawns the Mavis CLI binary with given arguments and optional stdin input. Used by the raw exec path for mavis_memory_append.
    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();
      });
    }
  • src/index.js:484-509 (registration)
    MavisServer class registers all tools (including mavis_memory_append) into a toolMap and handles CallToolRequest by parsing args with inputSchema and invoking runTool.
    this.toolMap = new Map(tools.map(t => [t.name, t]));
    
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: tools.map(t => ({
        name: t.name,
        description: t.description,
        inputSchema: normalizeObjectSchema(t.inputSchema),
      })),
    }));
    
    this.server.setRequestHandler(CallToolRequestSchema, async request => {
      const { name, arguments: args } = request.params;
      const tool = this.toolMap.get(name);
    
      if (!tool) {
        return { content: [{ type: 'text', text: `Error: unknown tool "${name}"` }], isError: true };
      }
    
      try {
        const parsedArgs = tool.inputSchema.parse(args || {});
        const results = await runTool(tool, parsedArgs);
        return { content: results };
      } catch (err) {
        return { content: [{ type: 'text', text: `Mavis error: ${err.message}` }], isError: true };
      }
    });
Behavior3/5

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

With no annotations, the description carries full burden. It indicates a write operation ('append'), but does not specify side effects such as whether content is appended to existing topics, memory limits, or whether it mutates state irreversibly.

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?

Single sentence, front-loads the verb and resource, no extraneous words. Efficiently communicates core action.

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

Completeness3/5

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

Adequate for an append operation with 4 parameters and no output schema. Could mention that the tool returns nothing or provide confirmation behavior, but sibling context (memory_search) implies memory storage. Missing usage examples or return info.

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?

Schema coverage is 100%, so baseline is 3. Description adds no extra meaning beyond the schema's parameter descriptions; it only repeats scope options. No clarification on optional 'topic' or conditional 'agentName' beyond schema.

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?

Description clearly states the verb 'Append' and resource 'Mavis memory' with three scope levels (user, agent, project). This distinguishes it from the sibling 'mavis_memory_search', which searches memory.

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?

No guidance on when to use this tool versus alternatives like 'mavis_memory_search' or how to choose between scope levels. Lacks context on prerequisites or situations where appending is appropriate.

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