Skip to main content
Glama

mavis_cron_create

Create a scheduled cron job for recurring tasks or reminders by specifying an agent, schedule, and prompt.

Instructions

Create a scheduled cron job (self-reminder, recurring task, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentNameYesAgent name or ID to own the cron task
cronNameYesCron task name
scheduleYesCron schedule expression (e.g. "*/5 * * * *" for every 5 min)
promptYesPrompt to send when the cron fires
timezoneNoTimezone (e.g. Asia/Shanghai)
sessionModeNoSession mode: sessionId or new
sessionIdNoSession ID when sessionMode=sessionId
disableNoCreate the task disabled

Implementation Reference

  • src/index.js:300-323 (registration)
    Tool spec for 'mavis_cron_create' registered in the tools array. Defines name, description, inputSchema (Zod), outputMode, execFn (execMavis), and buildArgs (constructs CLI args 'cron create ...').
    {
      name: 'mavis_cron_create',
      description: 'Create a scheduled cron job (self-reminder, recurring task, etc.)',
      inputSchema: z.object({
        agentName: z.string().describe('Agent name or ID to own the cron task'),
        cronName: z.string().describe('Cron task name'),
        schedule: z.string().describe('Cron schedule expression (e.g. "*/5 * * * *" for every 5 min)'),
        prompt: z.string().describe('Prompt to send when the cron fires'),
        timezone: z.string().optional().describe('Timezone (e.g. Asia/Shanghai)'),
        sessionMode: z.enum(['sessionId', 'new']).optional().describe('Session mode: sessionId or new'),
        sessionId: z.string().optional().describe('Session ID when sessionMode=sessionId'),
        disable: z.boolean().optional().describe('Create the task disabled')
      }),
      execFn: execMavis,
      outputMode: OUTPUT_RAW,
      buildArgs: ({ agentName, cronName, schedule, prompt, timezone, sessionMode, sessionId, disable }) => {
        const args = ['cron', 'create', agentName, cronName, '--schedule', schedule, '--prompt', prompt];
        if (timezone) args.push('--timezone', timezone);
        if (sessionMode) args.push('--session-mode', sessionMode);
        if (sessionId) args.push('--session-id', sessionId);
        if (disable) args.push('--disable');
        return args;
      }
    },
  • Input schema (Zod) for mavis_cron_create: required fields agentName, cronName, schedule, prompt; optional fields timezone, sessionMode, sessionId, disable.
    inputSchema: z.object({
      agentName: z.string().describe('Agent name or ID to own the cron task'),
      cronName: z.string().describe('Cron task name'),
      schedule: z.string().describe('Cron schedule expression (e.g. "*/5 * * * *" for every 5 min)'),
      prompt: z.string().describe('Prompt to send when the cron fires'),
      timezone: z.string().optional().describe('Timezone (e.g. Asia/Shanghai)'),
      sessionMode: z.enum(['sessionId', 'new']).optional().describe('Session mode: sessionId or new'),
      sessionId: z.string().optional().describe('Session ID when sessionMode=sessionId'),
      disable: z.boolean().optional().describe('Create the task disabled')
    }),
  • execMavis helper: spawns the mavis CLI binary with args, pipes stdin, captures stdout/stderr, resolves with trimmed stdout on success. The cron command doesn't need session injection since 'cron' is not in SESSION_COMMANDS set.
    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();
      });
    }
  • runTool handler: dispatches tool execution. For mavis_cron_create (which has execFn=execMavis), it calls execMavis with the CLI args built by buildArgs, then returns the raw output string (OUTPUT_RAW).
    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 }];
      });
    }
Behavior2/5

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

No annotations provided. Description does not disclose side effects, persistence, duplicates handling, or any behavioral details beyond creation. Does not contradict annotations as none exist.

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 is concise and front-loaded with purpose. However, it could include more useful context without being verbose.

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?

No output schema, and description does not mention return value, confirmation, or error conditions. For a tool with 8 parameters, more context is needed to understand the full operation.

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 description coverage is 100%, so parameters are well-documented in schema. Description adds no extra meaning beyond restating the tool's purpose. Baseline 3 is appropriate.

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 action ('Create') and resource ('scheduled cron job'), with examples (self-reminder, recurring task). It also distinguishes from siblings like mavis_cron_delete and mavis_cron_list.

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 vs alternatives. Does not specify prerequisites, conditions, or that it should not be used for one-time tasks.

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