@nbiish/cognitive-tools-mcp 0.9.10 → 0.9.12

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.
Files changed (2) hide show
  1. package/build/index.js +18 -69
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * -----------------------------------------------------------------------------
4
4
  * Gikendaasowin Aabajichiganan - Core Cognitive Tools MCP Server
5
5
  *
6
- * Version: 0.9.8
6
+ * Version: 0.9.12
7
7
  *
8
8
  * Description: Provides a suite of cognitive tools for an AI Pair Programmer,
9
9
  * enabling structured reasoning, planning, analysis, and iterative
@@ -36,12 +36,12 @@
36
36
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
37
37
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
38
38
  import { z } from "zod";
39
- export const version = "0.9.8";
39
+ export const version = "0.9.12";
40
40
  // --- Server Definition ---
41
41
  const server = new McpServer({
42
42
  name: "gikendaasowin-aabajichiganan-mcp",
43
43
  version: version,
44
- description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite v0.9.8: Enables structured, iterative reasoning (Chain of Thought/Draft), planning, and analysis for AI agents, focusing on the cognitive loop. MANDATORY `think` step integrates results."
44
+ description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite v0.9.12: Enables structured, iterative reasoning (Chain of Thought/Draft), planning, and analysis for AI agents, focusing on the cognitive loop. MANDATORY `think` step integrates results."
45
45
  });
46
46
  // --- Logging Helpers ---
47
47
  /**
@@ -78,7 +78,7 @@ function logToolError(toolName, error) {
78
78
  return {
79
79
  content: [{
80
80
  type: "text",
81
- text: `Error executing tool '${toolName}': ${errorMessage}. Please analyze this error in your next 'think' step and adjust your plan.`
81
+ text: `Error executing tool '${toolName}': ${errorMessage}.`
82
82
  }]
83
83
  };
84
84
  }
@@ -105,20 +105,13 @@ server.tool("assess_cuc_n_mode", "**Mandatory Pre-Deliberation Assessment.** Eva
105
105
  if (!cucnRegex.test(assessment_and_choice)) {
106
106
  throw new Error('Invalid assessment: String must include "CUC-N Ratings:".');
107
107
  }
108
- /* // User request: Remove strict check for 'Recommended Initial Strategy:'
109
- if (!strategyRegex.test(assessment_and_choice)) {
110
- throw new Error('Invalid assessment: String must include "Recommended Initial Strategy:".');
111
- }
112
- */
113
108
  const modeMatch = assessment_and_choice.match(modeRegex);
114
109
  if (!modeMatch || !modeMatch[1]) {
115
110
  throw new Error('Invalid assessment: String must include explicit "Selected Mode: think" or "Selected Mode: quick_think".');
116
111
  }
117
112
  const selectedMode = modeMatch[1].toLowerCase();
118
- logToolResult(toolName, true, `Selected mode: ${selectedMode} - Returning original assessment.`);
119
- // Log the full assessment server-side for traceability
113
+ logToolResult(toolName, true, `Selected mode: ${selectedMode}`);
120
114
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Assessment Details:\n${assessment_and_choice}`);
121
- // Return original input string without reminder
122
115
  return { content: [{ type: "text", text: assessment_and_choice }] };
123
116
  }
124
117
  catch (error) {
@@ -142,40 +135,27 @@ server.tool("think", "**MANDATORY Central Hub for Analysis and Planning.** Calle
142
135
  }
143
136
  // Define required sections (more flexible now)
144
137
  const requiredSections = [
145
- ["## Analysis:", "## Observe:", "## Observation:"], // Accept various observation formats
146
- ["## Orient:", "## Orientation:"], // Optional but recognized
147
- ["## Plan:", "## Decide:", "## Decision:"], // Decision-related sections
148
- ["## Reason:", "## Reasoning:", "## Analysis:"], // Reasoning-related sections
149
- ["## Act:", "## Action:", "## Execution:"], // Action-related sections
138
+ ["## Analysis:", "## Observe:", "## Observation:"],
139
+ ["## Orient:", "## Orientation:"],
140
+ ["## Plan:", "## Decide:", "## Decision:"],
141
+ ["## Reason:", "## Reasoning:", "## Analysis:"],
142
+ ["## Act:", "## Action:", "## Execution:"],
150
143
  ["## Verification:"],
151
144
  ["## Risk & Contingency:", "## Risks:", "## Challenges:"],
152
145
  ["## Learning & Adaptation:", "## Self-Correction:", "## Learning:"]
153
146
  ];
154
- // Check if each required section group has at least one match
155
147
  const missingSections = requiredSections.filter(sectionGroup => !sectionGroup.some(section => thought.includes(section)));
156
- // Build validation report
157
148
  let validationReport = [];
158
149
  if (missingSections.length > 0) {
159
150
  validationReport.push("WARNING: Some recommended sections might be missing. Consider including observation, orientation, decision, reasoning, action, verification, risks, and learning components in your thought process.");
160
151
  }
161
- // Log validation results
162
152
  if (validationReport.length > 0) {
163
153
  console.warn(`[${new Date().toISOString()}] [CognitiveToolsServer] Think Tool Validation Report:\n${validationReport.join("\n")}`);
164
154
  }
165
- // Enhanced logging with simplified format detection
166
155
  const format = thought.includes("## Observe:") ? "OODReAct-style" : "Traditional";
167
156
  logToolResult(toolName, true, `Thought logged (Style: ${format}, Length: ${thought.length})`);
168
- // Return thought with metadata
169
157
  return {
170
- content: [{
171
- type: "text",
172
- text: thought
173
- }],
174
- metadata: {
175
- format,
176
- validationReport,
177
- timestamp: new Date().toISOString()
178
- }
158
+ content: [{ type: "text", text: thought }]
179
159
  };
180
160
  }
181
161
  catch (error) {
@@ -198,7 +178,6 @@ server.tool("quick_think", "Cognitive Checkpoint for streamlined processing and
198
178
  throw new Error('Invalid brief_thought: Must be a non-empty string.');
199
179
  }
200
180
  logToolResult(toolName, true, `Logged: ${brief_thought.substring(0, 80)}...`);
201
- // Returns the brief thought, similar to 'think', for grounding.
202
181
  return { content: [{ type: "text", text: brief_thought }] };
203
182
  }
204
183
  catch (error) {
@@ -226,11 +205,9 @@ server.tool("gauge_confidence", "Meta-Cognitive Checkpoint. Guides *internal sta
226
205
  throw new Error('Invalid confidence assessment: String must include "Confidence Level: High/Medium/Low" and justification.');
227
206
  }
228
207
  const level = match[1];
229
- const emphasis = (level.toLowerCase() !== 'high') ? "CRITICAL: Analyze implications of non-High confidence." : "Proceed with analysis.";
230
- const resultText = `Confidence Gauge Completed. Stated Level: ${level}. Assessment Text Logged. MANDATORY: Analyze this confidence level and justification in your next 'think' step. ${emphasis}`;
231
208
  logToolResult(toolName, true, `Level: ${level}`);
232
209
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Confidence Details:\n${assessment_and_confidence}`);
233
- return { content: [{ type: "text", text: resultText }] };
210
+ return { content: [{ type: "text", text: assessment_and_confidence }] };
234
211
  }
235
212
  catch (error) {
236
213
  return logToolError(toolName, error);
@@ -252,14 +229,12 @@ server.tool("chain_of_thought", "Guides *internal generation* of **detailed, ste
252
229
  if (!generated_cot_text || typeof generated_cot_text !== 'string' || !problem_statement || typeof problem_statement !== 'string') {
253
230
  throw new Error('Both generated_cot_text and problem_statement must be non-empty strings.');
254
231
  }
255
- // Validate CoT format - should have clear steps
256
232
  if (!generated_cot_text.match(/step|phase|:\s|^\d+[\.\)]/im)) {
257
233
  throw new Error('Invalid CoT format: Must contain clear reasoning steps (numbered, labeled as steps/phases, or with clear delineation).');
258
234
  }
259
- const resultText = `Chain of Thought Completed. Problem: "${problem_statement.substring(0, 100)}..."\nReasoning Steps Logged. MANDATORY: Analyze this reasoning chain in your next 'think' step to extract insights, identify potential flaws/gaps, and plan concrete next actions.`;
260
235
  logToolResult(toolName, true, `Problem: ${problem_statement.substring(0, 50)}...`);
261
236
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Details:\nProblem: ${problem_statement}\nReasoning:\n${generated_cot_text}`);
262
- return { content: [{ type: "text", text: resultText }] };
237
+ return { content: [{ type: "text", text: generated_cot_text }] };
263
238
  }
264
239
  catch (error) {
265
240
  return logToolError(toolName, error);
@@ -281,18 +256,15 @@ server.tool("plan_and_solve", "Guides *internal generation* of a **structured pl
281
256
  if (!generated_plan_text || typeof generated_plan_text !== 'string' || !task_objective || typeof task_objective !== 'string') {
282
257
  throw new Error('Both generated_plan_text and task_objective must be non-empty strings.');
283
258
  }
284
- // Validate plan format - should have clear sections and structure
285
259
  if (!generated_plan_text.match(/phase|step|goal|objective|:\s|^\d+[\.\)]/im)) {
286
260
  throw new Error('Invalid plan format: Must contain clear sections (phases, steps, goals) with proper structure.');
287
261
  }
288
- // Validate plan includes risk consideration
289
262
  if (!generated_plan_text.toLowerCase().includes('risk') && !generated_plan_text.toLowerCase().includes('challenge')) {
290
263
  throw new Error('Invalid plan format: Must include risk/challenge assessment.');
291
264
  }
292
- const resultText = `Plan Generation Completed. Task: "${task_objective.substring(0, 100)}..."\nPlan Structure Logged. MANDATORY: Analyze this plan in your next 'think' step to verify feasibility, refine if needed, and confirm the first concrete action step.`;
293
265
  logToolResult(toolName, true, `Task: ${task_objective.substring(0, 50)}...`);
294
266
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Details:\nTask: ${task_objective}\nPlan:\n${generated_plan_text}`);
295
- return { content: [{ type: "text", text: resultText }] };
267
+ return { content: [{ type: "text", text: generated_plan_text }] };
296
268
  }
297
269
  catch (error) {
298
270
  return logToolError(toolName, error);
@@ -318,29 +290,8 @@ server.tool("chain_of_draft", "Signals that one or more **internal drafts** have
318
290
  if (!draft_description || typeof draft_description !== 'string' || draft_description.trim().length === 0) {
319
291
  throw new Error('Invalid draft_description: Must provide a description.');
320
292
  }
321
- // Format response in markdown with CoD guidance and next tool recommendation
322
- const resultText = `### Chain of Draft Signal Received
323
- #### Draft Description
324
- ${draft_description}
325
-
326
- #### Chain of Draft (CoD) Reminders
327
- - Keep steps concise (< 5 words)
328
- - Use equations/symbols when possible
329
- - Focus on essential information
330
- - End drafts with #### + conclusion
331
-
332
- #### Next Steps
333
- 1. MANDATORY: Use \`think\` tool to analyze this draft:
334
- - Evaluate correctness and completeness
335
- - Check alignment with goals
336
- - Plan concrete next actions
337
- 2. Consider using \`reflection\` tool if deeper critique needed
338
- 3. Use \`synthesize_prior_reasoning\` if context consolidation helpful
339
-
340
- #### Status
341
- Draft(s) ready for analysis. Proceed with mandatory \`think\` step.`;
342
293
  logToolResult(toolName, true);
343
- return { content: [{ type: "text", text: resultText }] };
294
+ return { content: [{ type: "text", text: draft_description }] };
344
295
  }
345
296
  catch (error) {
346
297
  return logToolError(toolName, error);
@@ -366,8 +317,7 @@ server.tool("reflection", "Guides *internal generation* of a critical self-evalu
366
317
  if (!input_subject_description || typeof input_subject_description !== 'string' || input_subject_description.trim().length === 0) {
367
318
  throw new Error('Invalid input_subject_description: Must describe what was critiqued.');
368
319
  }
369
- logToolResult(toolName, true, `Returned critique for analysis (length: ${generated_critique_text.length})`);
370
- // Returns the actual critique text received. The AI must analyze this in the next 'think' step.
320
+ logToolResult(toolName, true, `Critique length: ${generated_critique_text.length}`);
371
321
  return { content: [{ type: "text", text: generated_critique_text }] };
372
322
  }
373
323
  catch (error) {
@@ -393,8 +343,7 @@ server.tool("synthesize_prior_reasoning", "Context Management Tool. Guides *inte
393
343
  if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) {
394
344
  throw new Error('Invalid context_to_summarize_description: Must describe what was summarized.');
395
345
  }
396
- logToolResult(toolName, true, `Returned summary for analysis (length: ${generated_summary_text.length})`);
397
- // Returns the actual summary text received. The AI must analyze/use this in the next 'think' step.
346
+ logToolResult(toolName, true, `Summary length: ${generated_summary_text.length}`);
398
347
  return { content: [{ type: "text", text: generated_summary_text }] };
399
348
  }
400
349
  catch (error) {
@@ -441,7 +390,7 @@ async function main() {
441
390
  await server.connect(transport);
442
391
  const border = '-----------------------------------------------------';
443
392
  console.error(border);
444
- console.error(` ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite v0.9.8: Enables structured, iterative reasoning (Chain of Thought/Draft), planning, and analysis for AI agents, focusing on the cognitive loop. MANDATORY \`think\` step integrates results.`);
393
+ console.error(` ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite v0.9.12: Enables structured, iterative reasoning (Chain of Thought/Draft), planning, and analysis for AI agents, focusing on the cognitive loop. MANDATORY \`think\` step integrates results.`);
445
394
  console.error(` Version: ${version}`);
446
395
  console.error(' Status: Running on stdio, awaiting MCP requests...');
447
396
  console.error(border);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbiish/cognitive-tools-mcp",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "description": "Cognitive Tools MCP: SOTA reasoning suite focused on iterative refinement and tool integration for AI Pair Programming. Enables structured, iterative problem-solving through Chain of Draft methodology, with tools for draft generation, analysis, and refinement. Features advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment & thought mode selection (`assess_cuc_n_mode`), context synthesis, confidence gauging, proactive planning, explicit reasoning (CoT), and reflection with content return. Alternative package name for gikendaasowin-aabajichiganan-mcp.",
5
5
  "private": false,
6
6
  "type": "module",