Skip to main content
Glama
TAgents

Planning System MCP Server

by TAgents

update_goal

Atomically update a goal's title, description, priority, status, type, success criteria, promotion to intention, linked plans, and achievers in a single request.

Instructions

Atomic goal update. Subsumes update_goal + link_plan_to_goal + unlink_plan_from_goal + add_achiever + remove_achiever. All changes apply together.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goal_idYes
changesYes

Implementation Reference

  • The main handler function for the update_goal tool. Receives goal_id and changes, applies direct field updates (title, description, priority, status, success_criteria, goal_type, promote_to_intention), then processes add/remove linked plans and add/remove achievers. Returns a summary of applied changes, failures, and the updated goal.
    async function updateGoalHandler(args, apiClient) {
      const { goal_id, changes } = args;
      const applied = [];
      const failures = [];
    
      // Direct field updates
      const directFields = {};
      for (const k of ['title', 'description', 'priority', 'status', 'success_criteria']) {
        if (changes[k] !== undefined) directFields[k] = changes[k];
      }
      if (changes.goal_type) directFields.goalType = changes.goal_type;
      if (changes.promote_to_intention) directFields.goalType = 'intention';
    
      if (Object.keys(directFields).length) {
        try {
          await apiClient.goals.update(goal_id, directFields);
          applied.push('direct_fields');
        } catch (err) {
          failures.push({ step: 'direct_fields', error: err.message });
        }
      }
    
      for (const planId of safeArray(changes.add_linked_plans)) {
        try { await apiClient.goals.linkPlan(goal_id, planId); applied.push(`link_plan:${planId}`); }
        catch (err) { failures.push({ step: `link_plan:${planId}`, error: err.message }); }
      }
      for (const planId of safeArray(changes.remove_linked_plans)) {
        try { await apiClient.goals.unlinkPlan(goal_id, planId); applied.push(`unlink_plan:${planId}`); }
        catch (err) { failures.push({ step: `unlink_plan:${planId}`, error: err.message }); }
      }
      for (const nodeId of safeArray(changes.add_achievers)) {
        try { await apiClient.goals.addAchiever(goal_id, nodeId); applied.push(`add_achiever:${nodeId}`); }
        catch (err) { failures.push({ step: `add_achiever:${nodeId}`, error: err.message }); }
      }
      for (const nodeId of safeArray(changes.remove_achievers)) {
        try {
          const achievers = await apiClient.goals.listAchievers(goal_id);
          const link = safeArray(achievers.achievers || achievers).find((a) => a.source_node_id === nodeId);
          if (link) {
            await apiClient.goals.removeAchiever(goal_id, link.id);
            applied.push(`remove_achiever:${nodeId}`);
          }
        } catch (err) {
          failures.push({ step: `remove_achiever:${nodeId}`, error: err.message });
        }
      }
    
      let goal = null;
      try { goal = await apiClient.goals.get(goal_id); } catch {}
    
      return formatResponse({ as_of: asOf(), goal_id, applied_changes: applied, failures, goal });
    }
  • The input schema definition for update_goal tool. Defines required fields: goal_id (string) and changes (object) containing optional fields like title, description, priority, status, goal_type, success_criteria, promote_to_intention, add_linked_plans, remove_linked_plans, add_achievers, remove_achievers.
    const updateGoalDefinition = {
      name: 'update_goal',
      description:
        "Atomic goal update. Subsumes update_goal + link_plan_to_goal + unlink_plan_from_goal " +
        "+ add_achiever + remove_achiever. All changes apply together.",
      inputSchema: {
        type: 'object',
        properties: {
          goal_id: { type: 'string' },
          changes: {
            type: 'object',
            properties: {
              title: { type: 'string' },
              description: { type: 'string' },
              priority: { type: 'integer' },
              status: { type: 'string' },
              goal_type: { type: 'string', enum: ['desire', 'intention'] },
              success_criteria: {},
              promote_to_intention: { type: 'boolean' },
              add_linked_plans: { type: 'array', items: { type: 'string' } },
              remove_linked_plans: { type: 'array', items: { type: 'string' } },
              add_achievers: { type: 'array', items: { type: 'string' } },
              remove_achievers: { type: 'array', items: { type: 'string' } },
            },
          },
        },
        required: ['goal_id', 'changes'],
      },
    };
  • Tool registration exports from desires.js. The updateGoalDefinition is included in the definitions array and updateGoalHandler is mapped to 'update_goal' in the handlers object, which is consumed by bdi/index.js and ultimately by src/tools.js (setupTools).
    module.exports = {
      definitions: [listGoalsDefinition, updateGoalDefinition, deriveSubgoalDefinition],
      handlers: {
        list_goals: listGoalsHandler,
        update_goal: updateGoalHandler,
        derive_subgoal: deriveSubgoalHandler,
      },
    };
  • src/tools.js:19-65 (registration)
    Top-level MCP tool setup. The setupTools function wires BDI tool definitions and handlers into an MCP server using ListToolsRequestSchema and CallToolRequestSchema. This is where update_goal gets registered with the MCP server.
    function setupTools(server, apiClientOverride) {
      const apiClient = apiClientOverride || defaultApiClient;
    
      if (process.env.NODE_ENV === 'development') {
        console.error(`Setting up MCP tools (${bdiToolDefinitions.length} BDI tools)`);
      }
    
      server.setRequestHandler(ListToolsRequestSchema, async () => {
        return { tools: bdiToolDefinitions };
      });
    
      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);
        } catch (err) {
          if (process.env.NODE_ENV === 'development') {
            console.error(`Tool ${name} threw:`, err);
          }
          return {
            isError: true,
            content: [{
              type: 'text',
              text: `Tool ${name} failed: ${err.message || String(err)}`,
            }],
          };
        }
      });
    }
    
    module.exports = { setupTools };
  • Shared helpers used by updateGoalHandler: asOf() for timestamps, formatResponse() for MCP response formatting, errorResponse() for error formatting, and safeArray() for safely iterating arrays of linked plans and achievers.
    /**
     * Shared helpers for BDI tool implementations.
     */
    
    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 });
    }
    
    function safeArray(value) {
      return Array.isArray(value) ? value : [];
    }
    
    module.exports = { asOf, formatResponse, errorResponse, safeArray };
Behavior3/5

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

The description highlights atomicity ('All changes apply together'), which is valuable behavioral context beyond the schema, but provides no details on side effects, permissions, or error handling.

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 concise (two sentences), front-loaded with the key idea, and avoids redundancy. Slightly more structure could improve readability.

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 nested parameter structure and no output schema, the description fails to explain the changes object fields or return value, making it incomplete for safe use.

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?

With 0% schema description coverage, the description adds no explanation for parameters like goal_id or the changes object, leaving their semantics entirely to inference.

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 'Atomic goal update' and lists the subsumed operations (update_goal, link_plan_to_goal, etc.), making the tool's purpose specific and distinguishing it from siblings like 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 Guidelines4/5

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

The description implies this tool should be used instead of calling multiple individual tools for goal updates, linking plans, and managing achievers, but lacks explicit 'when not to use' or alternative references.

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