Skip to main content
Glama
TAgents

Planning System MCP Server

by TAgents

plan_analysis

Analyze a plan for impact, critical path, bottlenecks, or coherence to identify how changes affect tasks and dependencies.

Instructions

Advanced plan reads: impact analysis (delay/block/remove), critical path, bottleneck list, or coherence check.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plan_idYes
typeYes
node_idNo
scenarioNo

Implementation Reference

  • The handler function that executes the plan_analysis tool logic. It dispatches on the 'type' argument (critical_path, bottlenecks, impact, coherence) and makes API calls or runs coherence checks, returning formatted results.
    async function planAnalysisHandler(args, apiClient) {
      const { plan_id, type, node_id, scenario } = args;
      try {
        let result;
        if (type === 'critical_path') {
          result = (await apiClient.axiosInstance.get(`/plans/${plan_id}/critical-path`)).data;
        } else if (type === 'bottlenecks') {
          result = (await apiClient.axiosInstance.get(`/plans/${plan_id}/bottlenecks`)).data;
        } else if (type === 'impact') {
          if (!node_id) return errorResponse('invalid_arg', 'plan_analysis type=impact requires node_id');
          const params = new URLSearchParams({ scenario: scenario || 'block' });
          result = (await apiClient.axiosInstance.get(`/plans/${plan_id}/nodes/${node_id}/impact?${params}`)).data;
        } else if (type === 'coherence') {
          result = await apiClient.coherence.runCheck(plan_id);
        }
        return formatResponse({ as_of: asOf(), type, results: result || {} });
      } catch (err) {
        return errorResponse('upstream_unavailable', `plan_analysis failed: ${err.response?.data?.error || err.message}`);
      }
    }
  • The schema/definition for the plan_analysis tool, including its name, description, and inputSchema with properties for plan_id, type (enum), node_id, and scenario (enum).
    const planAnalysisDefinition = {
      name: 'plan_analysis',
      description:
        "Advanced plan reads: impact analysis (delay/block/remove), critical path, " +
        "bottleneck list, or coherence check.",
      inputSchema: {
        type: 'object',
        properties: {
          plan_id: { type: 'string' },
          type: { type: 'string', enum: ['impact', 'critical_path', 'bottlenecks', 'coherence'] },
          node_id: { type: 'string' },
          scenario: { type: 'string', enum: ['delay', 'block', 'remove'] },
        },
        required: ['plan_id', 'type'],
      },
    };
  • The tool is registered in the module.exports of beliefs.js, exported as part of the 'definitions' array and 'handlers' map under the key 'plan_analysis'.
    module.exports = {
      definitions: [
        briefingDefinition,
        taskContextDefinition,
        goalStateDefinition,
        recallKnowledgeDefinition,
        listPlansDefinition,
        searchDefinition,
        planAnalysisDefinition,
      ],
      handlers: {
        briefing: briefingHandler,
        task_context: taskContextHandler,
        goal_state: goalStateHandler,
        recall_knowledge: recallKnowledgeHandler,
        list_plans: listPlansHandler,
        search: searchHandler,
        plan_analysis: planAnalysisHandler,
      },
    };
  • The BDI index.js aggregates all definitions (including planAnalysisDefinition) into bdiToolDefinitions and all handlers (including planAnalysisHandler) into the handlers map, which are then exported and wired into the MCP server.
    const definitions = [
      ...beliefs.definitions,
      ...desires.definitions,
      ...intentions.definitions,
      ...utility.definitions,
    ];
    
    const handlers = {
      ...beliefs.handlers,
      ...desires.handlers,
      ...intentions.handlers,
      ...utility.handlers,
    };
    
    const names = new Set(definitions.map((t) => t.name));
    
    /**
     * Dispatch a BDI tool call.
     * @returns formatted MCP response, or undefined if the name isn't a BDI tool.
     */
    async function bdiToolHandler(name, args, apiClient) {
      if (!names.has(name)) return undefined;
      const handler = handlers[name];
      return handler(args || {}, apiClient);
    }
    
    module.exports = {
      bdiToolDefinitions: definitions,
      bdiToolHandler,
      bdiToolNames: names,
    };
  • Shared helper utilities (asOf, formatResponse, errorResponse) used by the planAnalysisHandler to format responses and errors.
    function asOf() {
      return new Date().toISOString();
    }
    
    function formatResponse(data) {
      if (data && data.error) {
        return {
          isError: true,
          content: [{ type: 'text', text: data.error }],
        };
      }
      return {
        content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
      };
    }
    
    function errorResponse(error_type, message, extra = {}) {
      return formatResponse({ error: message, error_type, ...extra });
    }
Behavior1/5

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

No annotations provided. Description says 'reads' implying read-only, but does not disclose error behaviors, auth needs, or what happens for invalid inputs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence but packs multiple analysis types. Could be better structured but is not excessively long.

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 4 parameters with enums and no output schema, the description lacks detail on when to use node_id or scenario, and what the tool returns.

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

Parameters1/5

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

Schema coverage is 0%. Description does not explain parameters like plan_id, type, node_id, scenario. No information on dependencies (e.g., node_id needed for impact).

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 tool performs advanced plan reads, listing specific analysis types: impact, critical path, bottlenecks, coherence. It distinguishes from siblings like list_plans or update_plan.

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 explicit guidance on when to use this tool versus alternatives like list_plans or update_plan. No mentioning of prerequisites or context.

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/TAgents/agent-planner-mcp'

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