Skip to main content
Glama

plan_intent

Read-only

Generate execution plans with policy checkpoints to coordinate and manage intent workflows through memory gateway capabilities.

Instructions

Generate an intent execution plan with policy checkpoints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intentIdYes
contextNo
mcpProfileNo
bundleIdNo
partnerProfileNo
delegationModeNo
approvedNo
repoPathNo

Implementation Reference

  • The planIntent function is the core logic for the 'plan_intent' MCP tool. It loads policy bundles, validates intents, ranks actions based on strategy, checks code graph impact, and evaluates delegation.
    function planIntent(options = {}) {
      const bundle = loadPolicyBundle(options.bundleId);
      const profile = assertKnownMcpProfile(options.mcpProfile || getActiveMcpProfile());
      const intentId = String(options.intentId || '').trim();
      const context = String(options.context || '').trim();
      const approved = options.approved === true;
      const tokenBudget = resolveTokenBudget(options.tokenBudget);
      const delegationMode = normalizeDelegationMode(options.delegationMode);
    
      if (!intentId) {
        throw new Error('intentId is required');
      }
    
      const intent = bundle.intents.find((item) => item.id === intentId);
      if (!intent) {
        throw new Error(`Unknown intent: ${intentId}`);
      }
    
      const requiredRisks = getRequiredApprovalRisks(bundle, profile);
      const requiresApproval = requiredRisks.includes(intent.risk);
      const checkpointRequired = requiresApproval && !approved;
      const partnerStrategy = buildPartnerStrategy({
        partnerProfile: options.partnerProfile,
        tokenBudget,
      });
      const rankedActions = rankActions(intent.actions, {
        modelPath: options.modelPath,
        partnerStrategy,
      });
      const plannedActions = partnerStrategy.profile === 'balanced'
        ? intent.actions
        : rankedActions.ranked;
      const phases = decomposeActions(plannedActions);
      const codegraphImpact = analyzeCodeGraphImpact({
        intentId,
        context,
        repoPath: options.repoPath,
      });
      const partnerChecks = mergeUnique([
        ...partnerStrategy.recommendedChecks,
        ...codegraphImpact.verificationHints,
      ]);
      const enrichedPartnerStrategy = {
        ...partnerStrategy,
        recommendedChecks: partnerChecks,
      };
      const basePlan = {
        bundleId: bundle.bundleId,
        mcpProfile: profile,
        partnerProfile: enrichedPartnerStrategy.profile,
        generatedAt: new Date().toISOString(),
        status: checkpointRequired ? 'checkpoint_required' : 'ready',
        intent: {
          id: intent.id,
          description: intent.description,
          risk: intent.risk,
        },
        context,
        requiresApproval,
        approved,
        checkpoint: checkpointRequired
          ? {
            type: 'human_approval',
            reason: `Intent '${intent.id}' has risk '${intent.risk}' under profile '${profile}'.`,
            requiredForRiskLevels: requiredRisks,
          }
          : null,
        actions: plannedActions,
        phases,
        tokenBudget: enrichedPartnerStrategy.tokenBudget || tokenBudget,
        partnerStrategy: enrichedPartnerStrategy,
        actionScores: rankedActions.scores,
        codegraphImpact,
        killSwitches: loadGatesConfig().gates
          .filter((g) => {
            const isHighRisk = ['high', 'critical'].includes(intent.risk);
            if (isHighRisk && (g.severity === 'high' || g.severity === 'critical')) return true;
    
            const actionNames = plannedActions.map((a) => a.name);
            return g.trigger && actionNames.some((name) => g.trigger.toLowerCase().includes(name.toLowerCase()));
          })
          .map((g) => ({
            id: g.id,
            layer: g.layer || 'Execution',
            action: g.action,
            severity: g.severity,
          })),
      };
      const delegation = evaluateDelegation({
        delegationMode,
        plan: basePlan,
        mcpProfile: profile,
        context,
        repoPath: options.repoPath,
      });
    
      return {
        ...basePlan,
        executionMode: delegation.executionMode,
        delegationEligible: delegation.delegationEligible,
        delegationScore: delegation.delegationScore,
        delegationReason: delegation.delegationReason,
        delegateProfile: delegation.delegateProfile,
        handoffContract: delegation.handoffContract,
      };
    }
  • The MCP handler registration for 'plan_intent' calls the planIntent function imported from intent-router.js.
    case 'plan_intent':
      return toTextResult(planIntent({
        intentId: args.intentId,
        context: args.context || '',
        mcpProfile: args.mcpProfile,
        bundleId: args.bundleId,
        partnerProfile: args.partnerProfile,
        delegationMode: args.delegationMode,
        approved: args.approved === true,
        repoPath: args.repoPath,
      }));
Behavior3/5

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

The annotations indicate readOnlyHint=true, suggesting this is a safe read operation. The description adds value by implying that the tool generates a plan with policy checkpoints, which could involve policy validation or planning steps, but it does not detail behavioral traits like rate limits, authentication needs, or what 'policy checkpoints' entail. There is no contradiction with annotations.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized, with no wasted information.

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 complexity of 8 parameters, 0% schema coverage, no output schema, and annotations only covering read-only status, the description is incomplete. It does not explain parameter roles, return values, or detailed behavior, making it inadequate for effective tool selection and invocation.

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?

With 0% schema description coverage and 8 parameters, the description does not add any meaning beyond the input schema. It mentions 'intent execution plan with policy checkpoints' but does not explain how parameters like 'intentId', 'context', or 'delegationMode' relate to this, failing to compensate for the 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 clearly states the action ('Generate') and the resource ('intent execution plan with policy checkpoints'), making the purpose understandable. However, it does not explicitly differentiate this tool from sibling tools like 'list_intents' or 'construct_context_pack', which could involve related operations, so it lacks sibling distinction.

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 'list_intents' for listing intents or 'construct_context_pack' for context-related tasks. There are no explicit when-to-use or when-not-to-use instructions, leaving usage context unclear.

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/IgorGanapolsky/mcp-memory-gateway'

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