goalstory_set_steps_order
Reorder steps in a goal to prioritize tasks or reorganize workflows by specifying the new sequence of step IDs.
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
TableJSON 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)Full handler registration for the 'goalstory_set_steps_order' tool. Converts input ordered_steps_ids to array if needed, POSTs to /steps/order API endpoint to reorder steps by assigning new order_ts timestamps based on array order, and returns formatted response with important notes on ordering.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 metadata and Zod input schema defining 'ordered_steps_ids' as an array of step ID strings in the desired order.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.", ), }), };