goalstory_set_steps_order
Reorganize and prioritize steps in a goal by defining a new sequence. Assigns updated timestamps based on the provided order to streamline workflows without deleting steps.
Instructions
Reorder steps in a goal by specifying the new sequence. This allows for prioritizing steps or reorganizing the workflow without deleting and recreating steps. IMPORTANT: Steps are ordered by their 'order_ts' timestamp in ascending order - the step with the earliest timestamp becomes step 1, and steps with later timestamps follow in sequence. The system will assign new timestamps based on the array order you provide.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ordered_steps_ids | Yes | Array of step IDs in the desired new order. The first ID in this array will become step 1 (earliest timestamp), the second ID will become step 2, and so on. The array of step IDs *MUST* contain the full set of step ids for the gaol. |
Implementation Reference
- src/index.ts:613-645 (handler)MCP tool handler implementation for 'goalstory_set_steps_order'. Converts input array if string, constructs POST body to /steps/order endpoint, calls API via doRequest, and returns formatted response with order explanation.server.tool( SET_STEPS_ORDER_TOOL.name, SET_STEPS_ORDER_TOOL.description, SET_STEPS_ORDER_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/steps/order`; // If ordered_steps_ids comes in as a string (for local development), convert it to array let ordered_steps_ids = args.ordered_steps_ids; if (typeof ordered_steps_ids === "string") { const idsAsString = ordered_steps_ids as string; ordered_steps_ids = idsAsString .split(",") .map((s) => s.trim()) .filter((s) => s.length > 0); } const body = { ordered_steps_ids, }; const result = await doRequest(url, "POST", body); return { content: [ { type: "text", text: `Steps order updated:\n${JSON.stringify(result, null, 2)}\n\nIMPORTANT: The first step in the array has the smallest 'order_ts' timestamp (step 1), and each subsequent step has progressively larger timestamps that determine their order in the sequence. Example: If step A has timestamp 12:00 and step B has timestamp 12:01, then step A is step 1 and step B is step 2.`, }, ], isError: false, }; }, );
- src/tools.ts:333-344 (schema)Tool schema definition including name, description, and Zod input schema for reordering steps by array of step IDs.export const SET_STEPS_ORDER_TOOL = { name: "goalstory_set_steps_order", description: "Reorder steps in a goal by specifying the new sequence. This allows for prioritizing steps or reorganizing the workflow without deleting and recreating steps. IMPORTANT: Steps are ordered by their 'order_ts' timestamp in ascending order - the step with the earliest timestamp becomes step 1, and steps with later timestamps follow in sequence. The system will assign new timestamps based on the array order you provide.", inputSchema: z.object({ ordered_steps_ids: z .array(z.string()) .describe( "Array of step IDs in the desired new order. The first ID in this array will become step 1 (earliest timestamp), the second ID will become step 2, and so on. The array of step IDs *MUST* contain the full set of step ids for the gaol.", ), }), };
- src/index.ts:613-645 (registration)Registration of the 'goalstory_set_steps_order' tool with MCP server using schema from tools.ts and inline handler.server.tool( SET_STEPS_ORDER_TOOL.name, SET_STEPS_ORDER_TOOL.description, SET_STEPS_ORDER_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/steps/order`; // If ordered_steps_ids comes in as a string (for local development), convert it to array let ordered_steps_ids = args.ordered_steps_ids; if (typeof ordered_steps_ids === "string") { const idsAsString = ordered_steps_ids as string; ordered_steps_ids = idsAsString .split(",") .map((s) => s.trim()) .filter((s) => s.length > 0); } const body = { ordered_steps_ids, }; const result = await doRequest(url, "POST", body); return { content: [ { type: "text", text: `Steps order updated:\n${JSON.stringify(result, null, 2)}\n\nIMPORTANT: The first step in the array has the smallest 'order_ts' timestamp (step 1), and each subsequent step has progressively larger timestamps that determine their order in the sequence. Example: If step A has timestamp 12:00 and step B has timestamp 12:01, then step A is step 1 and step B is step 2.`, }, ], isError: false, }; }, );