Skip to main content
Glama
TAgents

Planning System MCP Server

by TAgents

derive_subgoal

Propose a sub-goal under an existing parent goal to break down strategic objectives. Use draft status for autonomous creation and human review before activation.

Instructions

Propose a sub-goal under an existing parent goal. parent_goal_id is mandatory — agents cannot create top-level goals (strategic direction is human-set). Defaults to status='active' for human-directed creation; pass status='draft' for autonomous loops so a human can review before promotion. Drafts surface in the dashboard pending queue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_goal_idYesRequired. The parent goal this sub-goal contributes to.
titleYes
descriptionNoOptional extended description, appended after rationale.
rationaleYesWhy this sub-goal is needed to achieve the parent. Becomes the description; surfaces in human review.
typeNooutcome
statusNoDefault 'active' for human-directed creation. Pass 'draft' when acting autonomously without explicit user direction.active
success_criteriaNoConcrete, observable conditions that mark this sub-goal achieved.
priorityNo

Implementation Reference

  • The deriveSubgoalHandler async function that executes the derive_subgoal tool logic. It validates the parent goal exists, composes description from rationale, constructs a payload, creates the sub-goal via the API client, and returns a formatted response.
    async function deriveSubgoalHandler(args, apiClient) {
      const { parent_goal_id, title, description, rationale, type = 'outcome', status = 'active', success_criteria, priority } = args;
    
      // Verify parent exists and inherit organization scope.
      let parent;
      try {
        parent = await apiClient.goals.get(parent_goal_id);
      } catch (err) {
        return errorResponse('not_found', `Parent goal ${parent_goal_id} not found or not accessible: ${err.message}`);
      }
    
      // Compose description: rationale is primary; optional description appended.
      const composedDescription = description
        ? `${rationale}\n\n${description}`
        : rationale;
    
      const payload = {
        title,
        description: composedDescription,
        type,
        status,
        parentGoalId: parent_goal_id,
        organizationId: parent.organization_id || parent.organizationId || undefined,
      };
      if (success_criteria) payload.successCriteria = { criteria: success_criteria };
      if (typeof priority === 'number') payload.priority = priority;
    
      let goal;
      try {
        goal = await apiClient.goals.create(payload);
      } catch (err) {
        const upstream = err.response?.data?.error || err.message;
        return errorResponse('create_failed', `Failed to create sub-goal: ${upstream}`);
      }
    
      return formatResponse({
        as_of: asOf(),
        goal_id: goal.id,
        parent_goal_id,
        title: goal.title,
        status: goal.status,
        is_draft: goal.status === 'draft',
        next_step: goal.status === 'draft'
          ? "Sub-goal created as draft. It will surface in the dashboard pending queue for human review. Promote via update_goal({status: 'active'}) once approved."
          : "Sub-goal active. Link plans to it via update_goal({add_linked_plans: [...]}).",
      });
    }
  • The deriveSubgoalDefinition object containing the tool name, description, and inputSchema (which defines the JSON schema for all parameters: parent_goal_id, title, description, rationale, type, status, success_criteria, priority).
    const deriveSubgoalDefinition = {
      name: 'derive_subgoal',
      description:
        "Propose a sub-goal under an existing parent goal. parent_goal_id is " +
        "mandatory — agents cannot create top-level goals (strategic direction is " +
        "human-set). Defaults to status='active' for human-directed creation; pass " +
        "status='draft' for autonomous loops so a human can review before promotion. " +
        "Drafts surface in the dashboard pending queue.",
      inputSchema: {
        type: 'object',
        properties: {
          parent_goal_id: {
            type: 'string',
            description: "Required. The parent goal this sub-goal contributes to.",
          },
          title: { type: 'string' },
          description: { type: 'string', description: "Optional extended description, appended after rationale." },
          rationale: {
            type: 'string',
            description: "Why this sub-goal is needed to achieve the parent. Becomes the description; surfaces in human review.",
          },
          type: {
            type: 'string',
            enum: VALID_GOAL_TYPES,
            default: 'outcome',
          },
          status: {
            type: 'string',
            enum: VALID_STATUSES,
            default: 'active',
            description: "Default 'active' for human-directed creation. Pass 'draft' when acting autonomously without explicit user direction.",
          },
          success_criteria: {
            type: 'array',
            items: { type: 'string' },
            description: "Concrete, observable conditions that mark this sub-goal achieved.",
          },
          priority: { type: 'integer', default: 0 },
        },
        required: ['parent_goal_id', 'title', 'rationale'],
      },
    };
  • Module exports registering deriveSubgoalDefinition in the definitions array and deriveSubgoalHandler as derive_subgoal in the handlers map.
    module.exports = {
      definitions: [listGoalsDefinition, updateGoalDefinition, deriveSubgoalDefinition],
      handlers: {
        list_goals: listGoalsHandler,
        update_goal: updateGoalHandler,
        derive_subgoal: deriveSubgoalHandler,
      },
    };
  • BDI index aggregating all definitions and handlers (including derive_subgoal from desires) into merged arrays/maps, and exposing them via bdiToolDefinitions and bdiToolHandler.
    const definitions = [
      ...beliefs.definitions,
      ...desires.definitions,
      ...intentions.definitions,
      ...utility.definitions,
    ];
    
    const handlers = {
      ...beliefs.handlers,
      ...desires.handlers,
      ...intentions.handlers,
      ...utility.handlers,
    };
  • src/tools.js:30-48 (registration)
    Top-level tools.js wiring: bdiToolHandler dispatches CallToolRequestSchema requests by name (e.g., 'derive_subgoal') to the correct handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      if (process.env.NODE_ENV === 'development') {
        console.error(`Calling tool: ${name}`);
      }
    
      if (!bdiToolNames.has(name)) {
        return {
          isError: true,
          content: [{
            type: 'text',
            text: `Unknown tool: ${name}. v0.9.0 ships 15 BDI tools. Run get_started to see them, or check ../docs/MIGRATION_v0.9.md for the legacy → BDI mapping.`,
          }],
        };
      }
    
      try {
        return await bdiToolHandler(name, args, apiClient);
Behavior3/5

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

No annotations are present, so the description must carry behavioral disclosure. It reveals that agents cannot create top-level goals and that drafts surface in a pending queue. However, it does not specify idempotency, side effects, or what happens on success/failure.

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 three sentences, each adding distinct value: main purpose, constraint on top-level goals, and status guidance. No wasted words, and the key purpose is front-loaded.

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?

The description explains the core workflow and draft behavior but lacks details on the return value, uniqueness of title, or how success_criteria are used. Given no output schema, more completeness would help.

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?

The description adds value for the 'status' parameter by explaining when to use 'draft' vs 'active', but it does not explain other parameters like 'type', 'success_criteria', or 'priority'. Schema coverage is 63%, and the description mostly repeats schema for 'rationale' without enriching it beyond what is already stated.

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 'Propose a sub-goal under an existing parent goal' using a specific verb and resource. It reinforces that parent_goal_id is mandatory and that agents cannot create top-level goals, which distinguishes this tool from any potential goal-creation siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool, including the distinction between human-directed (default 'active') and autonomous loops (pass 'draft'). However, it does not explicitly mention alternatives or when not to use it.

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