@gotza02/sequential-thinking 2026.3.7 → 2026.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,21 +87,8 @@ If you have tried to fix the same problem 3 times and failed:
87
87
  blockId: z.string().optional().describe("ID for the current topic block (e.g., 'auth-debug', 'api-research'). Keep same ID to stay in context."),
88
88
  relatedToolCall: z.string().optional().describe("If type='execution', specify the tool name here (e.g., 'read_file', 'edit_file')"),
89
89
  toolResult: z.string().optional().describe("If type='observation', summarize the key findings from the tool output here"),
90
- complexity: z.preprocess((val) => {
91
- if (typeof val !== 'string')
92
- return val;
93
- const v = val.toLowerCase();
94
- if (['simple', 'easy', 'basic'].includes(v))
95
- return 'low';
96
- if (['standard', 'normal', 'regular'].includes(v))
97
- return 'medium';
98
- if (['critical', 'expert', 'very high'].includes(v))
99
- return 'high';
100
- // If it's a string but not one of the enum values, default to medium
101
- if (!['low', 'medium', 'high'].includes(v))
102
- return 'medium';
103
- return v;
104
- }, z.enum(['low', 'medium', 'high']).optional()).describe("Task complexity level. 'low': simple tasks, less strict. 'medium': standard. 'high': critical, requires critique & double verification."),
90
+ complexity: z.string().optional()
91
+ .describe("Task complexity level. 'low': simple tasks, less strict. 'medium': standard. 'high': critical, requires critique & double verification."),
105
92
  // Legacy Fields (backwards compatible)
106
93
  isRevision: z.boolean().optional().describe("Whether this revises previous thinking"),
107
94
  revisesThought: z.number().int().min(1).optional().describe("Which thought number is being reconsidered"),
@@ -112,14 +99,44 @@ If you have tried to fix the same problem 3 times and failed:
112
99
  options: z.array(z.string()).optional().describe("List of options for generation type"),
113
100
  selectedOption: z.string().optional().describe("The option selected for selection type")
114
101
  }, async (args) => {
115
- const thoughtNumber = args.thoughtNumber ?? (thinkingServer.getHistoryLength() + 1);
116
- const totalThoughts = args.totalThoughts ?? (thoughtNumber + 5);
117
- const input = { ...args, thoughtNumber, totalThoughts };
118
- const result = await thinkingServer.processThought(input);
119
- return {
120
- content: result.content,
121
- isError: result.isError
122
- };
102
+ try {
103
+ const thoughtNumber = args.thoughtNumber ?? (thinkingServer.getHistoryLength() + 1);
104
+ // Normalize complexity manually since we removed z.preprocess to avoid schema validation errors
105
+ let complexity = 'medium';
106
+ if (args.complexity) {
107
+ const v = args.complexity.toLowerCase();
108
+ if (['low', 'simple', 'easy', 'basic'].includes(v))
109
+ complexity = 'low';
110
+ else if (['high', 'critical', 'expert', 'very high'].includes(v))
111
+ complexity = 'high';
112
+ else
113
+ complexity = 'medium';
114
+ }
115
+ // Smart defaults for totalThoughts based on complexity
116
+ let defaultAdd = 5;
117
+ if (complexity === 'low')
118
+ defaultAdd = 3;
119
+ else if (complexity === 'high')
120
+ defaultAdd = 8;
121
+ const totalThoughts = args.totalThoughts ?? (thoughtNumber + defaultAdd);
122
+ const input = {
123
+ ...args,
124
+ thoughtNumber,
125
+ totalThoughts,
126
+ complexity: complexity
127
+ };
128
+ const result = await thinkingServer.processThought(input);
129
+ return {
130
+ content: result.content,
131
+ isError: result.isError
132
+ };
133
+ }
134
+ catch (error) {
135
+ return {
136
+ content: [{ type: "text", text: `Thinking Error: ${error instanceof Error ? error.message : String(error)}` }],
137
+ isError: true
138
+ };
139
+ }
123
140
  });
124
141
  // --- Clear Thought History ---
125
142
  server.tool("clear_thought_history", "Clear the sequential thinking history. Use this to start fresh when changing to a completely different task.", {}, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotza02/sequential-thinking",
3
- "version": "2026.3.7",
3
+ "version": "2026.3.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },