@nbiish/cognitive-tools-mcp 2.0.12 → 2.0.16
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.
- package/README.md +1 -0
- package/build/index.js +40 -138
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ Known as:
|
|
|
43
43
|
Both packages are maintained in parallel and receive the same updates. You can use either package name in your projects - they provide identical functionality.
|
|
44
44
|
|
|
45
45
|
**Recent Updates:**
|
|
46
|
+
- v2.0.15: Updated Zod schema usage in `server.tool` to fix type error and rebuilt.
|
|
46
47
|
- v2.0.6: Added `mental_sandbox` tool for logging internal cognitive simulations.
|
|
47
48
|
- v2.0.6: Removed prefixing from cognitive tool outputs to ensure verbatim logging.
|
|
48
49
|
- Resolved TypeScript compilation errors related to MCP SDK types and server configuration.
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* -----------------------------------------------------------------------------
|
|
4
|
-
* Gikendaasowin Aabajichiganan - Agentic Cognitive Tools MCP Server (v3.
|
|
4
|
+
* Gikendaasowin Aabajichiganan - Agentic Cognitive Tools MCP Server (v3.4)
|
|
5
5
|
*
|
|
6
6
|
* Description: Provides cognitive tools implementing the Gikendaasowin v7
|
|
7
7
|
* Agentic Operational Guidelines. Enforces a mandatory structured
|
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
* Chain-of-Thought (SCoT)**. Aligns with dynamic tool environments,
|
|
13
13
|
* including CodeAct preference. Returns Markdown.
|
|
14
14
|
*
|
|
15
|
-
* v3.
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* v3.4 Enhancements:
|
|
16
|
+
* - Enhanced the description of the `deliberate` tool to be expertly verbose,
|
|
17
|
+
* explaining the prompting techniques (CoT, CoD/CR, SCoT) before using acronyms,
|
|
18
|
+
* drawing from the provided research context for professional precision.
|
|
19
|
+
* - Maintained tooling compression, internal system prompt framing, and
|
|
20
|
+
* expanded cognitive technique acronyms (with explanations on first use in
|
|
21
|
+
* the main server description).
|
|
22
|
+
* - Simplified error reporting.
|
|
19
23
|
* -----------------------------------------------------------------------------
|
|
20
24
|
*/
|
|
21
25
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -24,9 +28,9 @@ import { z } from "zod";
|
|
|
24
28
|
// --- Server Definition ---
|
|
25
29
|
const serverInfo = {
|
|
26
30
|
name: "gikendaasowin-agentic-cognitive-tools-mcp",
|
|
27
|
-
version: "3.
|
|
28
|
-
// Updated description with expanded acronyms
|
|
29
|
-
description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v3.
|
|
31
|
+
version: "3.4.0", // Version reflects enhanced tool description verbosity
|
|
32
|
+
// Updated description with consolidated tooling and expanded acronyms
|
|
33
|
+
description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v3.4): Implements Gikendaasowin v7 Guidelines. Enforces MANDATORY internal **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle using the unified 'deliberate' tool. Starts with initial assessment/orientation, continues with structured deliberation and mandatory mental sandbox logging before actions. Guides adaptive reasoning (**Chain-of-Thought (CoT)**: step-by-step natural language reasoning; **Chain-of-Draft/Condensed Reasoning (CoD/CR)**: iterative refinement/concise steps; **Structured Chain-of-Thought (SCoT)**: reasoning incorporating program structures/plans) & CodeAct preference. Returns Markdown.`
|
|
30
34
|
};
|
|
31
35
|
const server = new McpServer(serverInfo);
|
|
32
36
|
// --- Logging Helpers (Internal - No changes needed) ---
|
|
@@ -50,8 +54,7 @@ function logToolResult(toolName, success, resultDetails) {
|
|
|
50
54
|
console.error(`[${timestamp}] [MCP Server] < Tool Result: ${toolName} - ${success ? 'Success' : 'Failure'}${resultDetails ? ` - ${resultDetails}` : ''}`);
|
|
51
55
|
}
|
|
52
56
|
/**
|
|
53
|
-
* Logs an error during tool execution and formats a standard error response for the LLM
|
|
54
|
-
* guiding towards the mandatory internal deliberation cycle with expanded acronyms on first use.
|
|
57
|
+
* Logs an error during tool execution and formats a standard error response for the LLM.
|
|
55
58
|
* @param toolName The name of the tool where the error occurred.
|
|
56
59
|
* @param error The error object or message.
|
|
57
60
|
* @returns An object matching the required MCP tool result structure containing the error message.
|
|
@@ -61,145 +64,44 @@ function logToolError(toolName, error) {
|
|
|
61
64
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
65
|
console.error(`[${timestamp}] [MCP Server] ! Tool Error: ${toolName} - ${errorMessage}`);
|
|
63
66
|
logToolResult(toolName, false, errorMessage); // Log failure result as well
|
|
64
|
-
//
|
|
67
|
+
// Simplified Error Reporting: Return only the core error message.
|
|
65
68
|
return {
|
|
66
69
|
content: [{
|
|
67
70
|
type: "text",
|
|
68
|
-
// Simpler error message, removing corrective action guidance.
|
|
69
71
|
text: `**TOOL EXECUTION ERROR in '${toolName}':** ${errorMessage}`
|
|
70
72
|
}]
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
|
-
// ---
|
|
75
|
+
// --- Consolidated Cognitive Deliberation & Refinement Step (v3.4) ---
|
|
74
76
|
/**
|
|
75
|
-
*
|
|
76
|
-
* Purpose: **Mandatory first step** for every new user request AND before any significant strategic pivot.
|
|
77
|
-
* Establishes initial context by assessing task characteristics (Complexity, Uncertainty, Consequence, Novelty - CUC-N)
|
|
78
|
-
* and performing the initial Observe/Orient steps of the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle.
|
|
79
|
-
* Workflow: **Perform this step** at the beginning of processing a user request or when changing overall approach.
|
|
80
|
-
* Its output informs the *first* full OOReDAct cycle (`think` step).
|
|
81
|
-
* Input: A single string provided by the LLM (treated as opaque data).
|
|
82
|
-
* Output: The input string, returned verbatim.
|
|
83
|
-
*/
|
|
84
|
-
server.tool("assess_and_orient",
|
|
85
|
-
// **Internal Framing:** Expanded OOReDAct on first mention.
|
|
86
|
-
"**Mandatory Initial Assessment & Orientation:** At the start of EVERY user request AND before any major change in strategy, you MUST perform this initial assessment and orientation. Analyze the request/situation using CUC-N (Complexity, Uncertainty, Consequence, Novelty) to perform the initial 'Observe' and 'Orient' steps of the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle. This assessment is CRITICAL for grounding your subsequent reasoning and planning within the main OOReDAct cycle.", {
|
|
87
|
-
// Input is a simple string, description reflects pass-through nature.
|
|
88
|
-
assessment_and_orientation_text: z.string().describe("Provide the assessment/orientation text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
|
|
89
|
-
},
|
|
90
|
-
// Simplified handler: No validation, just return input.
|
|
91
|
-
async ({ assessment_and_orientation_text }) => {
|
|
92
|
-
const toolName = 'assess_and_orient';
|
|
93
|
-
logToolCall(toolName);
|
|
94
|
-
try {
|
|
95
|
-
// No validation or processing - treat input as opaque string
|
|
96
|
-
logToolResult(toolName, true, `Input received (length: ${assessment_and_orientation_text.length})`);
|
|
97
|
-
// Log the raw input string
|
|
98
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${assessment_and_orientation_text}`);
|
|
99
|
-
// Return the input string directly
|
|
100
|
-
return { content: [{ type: "text", text: assessment_and_orientation_text }] };
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
// Catch only unexpected runtime errors
|
|
104
|
-
return logToolError(toolName, error);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Step: think (Mandatory OOReDAct Deliberation Cycle)
|
|
77
|
+
* Tool: deliberate (Unified Cognitive Process)
|
|
109
78
|
* Purpose: The **REQUIRED & CENTRAL cognitive process** for the **MANDATORY** structured deliberation cycle
|
|
110
|
-
* (**Observe-Orient-Reason-Decide-Act (OOReDAct)**).
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// **Internal Framing:** Expanded OOReDAct, CoT, CoD/CR, SCoT on first mention in this tool's description.
|
|
121
|
-
"**Mandatory OOReDAct Deliberation Cycle:** You MUST perform the full, structured **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle *after* the initial `assess_and_orient` step, *after* receiving new information (tool/CodeAct results, errors, USER input), and *before* any non-trivial action or final response. Follow the complete OOReDAct structure, adapting your reasoning style within the 'Reason' step (e.g., using detailed **Chain-of-Thought (CoT)** for complexity, concise **Chain-of-Draft/Condensed Reasoning (CoD/CR)** for efficiency, or **Structured Chain-of-Thought (SCoT)** for planning/code) for reliable, verifiable, and adaptive behavior.", {
|
|
122
|
-
// Input is a simple string, description reflects pass-through nature.
|
|
123
|
-
thought: z.string().describe("Provide the OOReDAct deliberation text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
|
|
124
|
-
},
|
|
125
|
-
// Simplified handler: No validation, just return input.
|
|
126
|
-
async ({ thought }) => {
|
|
127
|
-
const toolName = 'think';
|
|
128
|
-
logToolCall(toolName);
|
|
129
|
-
try {
|
|
130
|
-
// No validation or processing - treat input as opaque string
|
|
131
|
-
logToolResult(toolName, true, `Input received (length: ${thought.length})`);
|
|
132
|
-
// Log the raw input string
|
|
133
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${thought}`);
|
|
134
|
-
// Return the input string directly
|
|
135
|
-
return { content: [{ type: "text", text: thought }] };
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
// Catch only unexpected runtime errors
|
|
139
|
-
return logToolError(toolName, error);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
/**
|
|
143
|
-
* Step: quick_think (Minimal Cognitive Acknowledgement)
|
|
144
|
-
* Purpose: For acknowledging *simple, expected, non-problematic* outcomes ONLY, where the next step is
|
|
145
|
-
* *already clearly defined* by a prior **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle (`think` step)
|
|
146
|
-
* and requires NO re-evaluation or adaptation.
|
|
147
|
-
* Workflow: Use sparingly to maintain cognitive flow in straightforward sequences. **Does NOT replace the mandatory OOReDAct cycle**.
|
|
148
|
-
* The full OOReDAct cycle (`think` step) is MANDATORY for handling new information, errors, planning changes,
|
|
149
|
-
* or any step requiring analysis or decision-making.
|
|
150
|
-
* Input: A single string provided by the LLM (treated as opaque data).
|
|
151
|
-
* Output: The brief acknowledgement text (Markdown).
|
|
152
|
-
*/
|
|
153
|
-
server.tool("quick_think",
|
|
154
|
-
// **Internal Framing:** Expanded OOReDAct on first mention here.
|
|
155
|
-
"**Minimal Cognitive Acknowledgement:** Use ONLY for acknowledging *simple, expected, non-problematic* outcomes (e.g., 'Data fetch OK, proceeding with planned analysis') where the next step is *already determined* by a prior **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle (`think` step) and needs NO re-evaluation. Helps maintain flow in simple sequences. **This step DOES NOT satisfy the mandatory OOReDAct deliberation requirement.** Perform the full OOReDAct cycle (`think` step) for any analysis, planning, reasoning, error handling, or decision making.", {
|
|
156
|
-
// Input is a simple string, description reflects pass-through nature.
|
|
157
|
-
brief_thought: z.string().describe("Provide the brief acknowledgement text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
|
|
158
|
-
},
|
|
159
|
-
// Simplified handler: No validation, just return input.
|
|
160
|
-
async ({ brief_thought }) => {
|
|
161
|
-
const toolName = 'quick_think';
|
|
162
|
-
logToolCall(toolName);
|
|
163
|
-
try {
|
|
164
|
-
// No validation or processing - treat input as opaque string
|
|
165
|
-
logToolResult(toolName, true, `Input received (length: ${brief_thought.length})`);
|
|
166
|
-
// Log the raw input string
|
|
167
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${brief_thought}`);
|
|
168
|
-
// Return the input string directly
|
|
169
|
-
return { content: [{ type: "text", text: brief_thought }] };
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
// Catch only unexpected runtime errors
|
|
173
|
-
return logToolError(toolName, error);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
/**
|
|
177
|
-
* Tool: mental_sandbox (Mental Sandbox Simulation Logging)
|
|
178
|
-
* Purpose: **Mandatory Step** for logging the internal cognitive simulation (`<sandbox>`) BEFORE any non-trivial output,
|
|
179
|
-
* plan, decision, or action, encompassing steps like Hypothesis Generation/Testing, Constraint Checks,
|
|
180
|
-
* Confidence Scoring, and Pre-computational Analysis.
|
|
181
|
-
* Workflow: Invoke this tool to record the detailed simulation text. The tool functions as a passthrough,
|
|
182
|
-
* returning the provided text verbatim without modification.
|
|
183
|
-
* Input: A single string containing the detailed sandbox simulation text.
|
|
184
|
-
* Output: The input string, returned verbatim.
|
|
79
|
+
* (**Observe-Orient-Reason-Decide-Act (OOReDAct)**). This tool consolidates the functionality of
|
|
80
|
+
* `assess_and_orient`, `think`, `quick_think`, and `mental_sandbox` into a single, flexible interface.
|
|
81
|
+
* Workflow: **You MUST use this tool** for:
|
|
82
|
+
* 1. Initial assessment and orientation (`stage: "orient"`).
|
|
83
|
+
* 2. Full, structured OOReDAct deliberation after receiving new information or before non-trivial actions (`stage: "reason"`).
|
|
84
|
+
* 3. Brief cognitive acknowledgement of simple, expected outcomes (`stage: "acknowledge"`).
|
|
85
|
+
* 4. Logging the mandatory mental sandbox simulation before actions (`stage: "sandbox"`).
|
|
86
|
+
* Adapt your reasoning style within the 'Reason' stage using techniques like Chain-of-Thought, Chain-of-Draft/Condensed Reasoning, or Structured Chain-of-Thought.
|
|
87
|
+
* Input: An object containing the stage and corresponding cognitive content.
|
|
88
|
+
* Output: The provided content, returned verbatim.
|
|
185
89
|
*/
|
|
186
|
-
server.tool("
|
|
187
|
-
//
|
|
188
|
-
"**Mandatory
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const toolName = 'mental_sandbox';
|
|
195
|
-
logToolCall(toolName);
|
|
90
|
+
server.tool("deliberate",
|
|
91
|
+
// Expertly verbose description explaining techniques before acronyms
|
|
92
|
+
"**Unified Cognitive Process (Mandatory):** This is your REQUIRED tool for ALL internal cognitive steps, enforcing the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle. Use `stage: \"orient\"` for the MANDATORY initial assessment (Complexity, Uncertainty, Consequence, Novelty - CUC-N) and OOReDAct Observe/Orient steps at the start of ANY task or strategic pivot. Use `stage: \"reason\"` for the MANDATORY full OOReDAct deliberation cycle after receiving new information (tool/CodeAct results, errors, USER input) and BEFORE any non-trivial action or final response. Within the 'Reason' stage, adapt your reasoning style for optimal performance: employ **Chain-of-Thought** (step-by-step natural language reasoning for complex problems, enhancing accuracy), **Chain-of-Draft/Condensed Reasoning** (iterative refinement or concise steps for efficiency), or **Structured Chain-of-Thought** (reasoning that explicitly incorporates program structures, plans, or structured steps, particularly effective for code generation and structured tasks). Use `stage: \"acknowledge\"` ONLY for brief acknowledgements of simple, expected outcomes where the next step is already clearly defined by a prior 'reason' stage and needs NO re-evaluation. Use `stage: \"sandbox\"` to log the MANDATORY internal `<sandbox>` simulation (Hypothesis Testing, Constraint Checks, Confidence Scoring, Pre-computation, etc.) BEFORE any non-trivial output, plan, decision, or action, as per operational directives. This tool acts as a passthrough, returning the provided content verbatim.", z.object({
|
|
93
|
+
stage: z.enum(["orient", "reason", "acknowledge", "sandbox"]).describe("The current stage of the cognitive process."),
|
|
94
|
+
content: z.string().describe("The cognitive content for the specified stage (assessment, deliberation, acknowledgement, or sandbox simulation text). This tool acts as a passthrough.")
|
|
95
|
+
}).shape, async ({ stage, content }) => {
|
|
96
|
+
const toolName = 'deliberate';
|
|
97
|
+
logToolCall(toolName, `Stage: ${stage}`);
|
|
196
98
|
try {
|
|
197
|
-
//
|
|
198
|
-
logToolResult(toolName, true, `Input received (length: ${
|
|
199
|
-
// Log the raw input string
|
|
200
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${
|
|
99
|
+
// Treat input as opaque string for the specified stage
|
|
100
|
+
logToolResult(toolName, true, `Stage: ${stage}, Input received (length: ${content.length})`);
|
|
101
|
+
// Log the raw input string with stage context
|
|
102
|
+
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} (${stage}) Input String:\n${content}`);
|
|
201
103
|
// Return the input string directly
|
|
202
|
-
return { content: [{ type: "text", text:
|
|
104
|
+
return { content: [{ type: "text", text: content }] };
|
|
203
105
|
}
|
|
204
106
|
catch (error) {
|
|
205
107
|
// Catch only unexpected runtime errors
|
|
@@ -248,7 +150,7 @@ async function main() {
|
|
|
248
150
|
console.error(border);
|
|
249
151
|
console.error(` ${serverInfo.description}`); // Uses updated description
|
|
250
152
|
console.error(` Version: ${serverInfo.version}`);
|
|
251
|
-
console.error(` Enforcing Gikendaasowin v7 Guidelines with
|
|
153
|
+
console.error(` Enforcing Gikendaasowin v7 Guidelines with Unified 'deliberate' Tool`);
|
|
252
154
|
console.error(' Status: Running on stdio, awaiting MCP requests...');
|
|
253
155
|
console.error(border);
|
|
254
156
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
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",
|