Skip to main content
Glama

init_plan

Read-only

Sets up revision-bound planning context metadata for multi-agent collaboration on DOCX files.

Instructions

Initialize revision-bound context metadata for coordinated multi-agent planning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the DOCX file.
plan_nameNo
orchestrator_idNo

Implementation Reference

  • The main handler function for the init_plan tool. Resolves the session for the given file_path, creates a unique plan_context_id (plctx_*), and returns plan metadata including session info, base revision, edit count, and optional plan_name/orchestrator_id.
    export async function initPlan(
      manager: SessionManager,
      params: {
        file_path?: string;
        plan_name?: string;
        orchestrator_id?: string;
      },
    ): Promise<ToolResponse> {
      try {
        const resolved = await resolveSessionForTool(manager, params, { toolName: 'init_plan' });
        if (!resolved.ok) return resolved.response;
        const { session, metadata } = resolved;
    
        return ok(mergeSessionResolutionMetadata({
          plan_context_id: createPlanContextId(),
          file_path: manager.normalizePath(session.originalPath),
          session_epoch: session.createdAt.getTime(),
          base_revision: session.editRevision,
          edit_count: session.editCount,
          created_at: new Date().toISOString(),
          plan_context: {
            plan_name: optionalString(params.plan_name) ?? null,
            orchestrator_id: optionalString(params.orchestrator_id) ?? null,
            document_filename: session.filename,
          },
        }, metadata));
      } catch (e: unknown) {
        const msg = errorMessage(e);
        return err('PLAN_INIT_ERROR', `Failed to initialize plan context: ${msg}`);
      }
    }
  • Schema registration for the init_plan tool: defines input schema (file_path required, plan_name and orchestrator_id optional), description, and readOnlyHint=true annotation.
    {
      name: 'init_plan',
      description: 'Initialize revision-bound context metadata for coordinated multi-agent planning.',
      input: z.object({
        ...FILE_FIELD,
        plan_name: z.string().optional(),
        orchestrator_id: z.string().optional(),
      }),
      annotations: { readOnlyHint: true, destructiveHint: false },
    },
  • Dispatch routing in server.ts that maps the 'init_plan' tool name to the initPlan handler function.
    case 'init_plan':
      return await initPlan(sessions, args as Parameters<typeof initPlan>[1]);
  • Import of the initPlan handler from the init_plan.ts module.
    import { initPlan } from './tools/init_plan.js';
  • Helper function that generates a unique plan context ID with a 'plctx_' prefix using 12 random alphanumeric characters.
    function createPlanContextId(): string {
      const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
      const bytes = randomBytes(12);
      let suffix = '';
      for (let i = 0; i < 12; i += 1) {
        suffix += alphabet[bytes[i]! % alphabet.length];
      }
      return `plctx_${suffix}`;
    }
Behavior2/5

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

The description states 'Initialize revision-bound context metadata', which implies a write operation, but annotations indicate readOnlyHint=true and destructiveHint=false. This creates a potential contradiction regarding side effects. The description does not clarify whether the tool modifies document state or creates in-memory context.

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?

The description is a single concise sentence with no redundancy. However, it sacrifices completeness for brevity.

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?

Given the tool's complexity (initializing multi-agent planning context) and lack of output schema, the description is too minimal. It omits return behavior, prerequisites, and effects, making it insufficient for an agent to use effectively.

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

Parameters2/5

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

Only 33% of parameters have schema descriptions (file_path has one). The tool description does not explain 'plan_name' or 'orchestrator_id', leaving their meaning ambiguous. It fails to compensate for low schema coverage.

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 uses a specific verb 'Initialize' and refers to 'revision-bound context metadata' for 'coordinated multi-agent planning', clearly distinguishing it from siblings like 'apply_plan' or 'merge_plans'. However, the term 'revision-bound' may be unclear without domain context.

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 such as 'apply_plan' or 'merge_plans'. No prerequisites or exclusion conditions are mentioned.

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/UseJunior/safe-docx'

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