@nbiish/cognitive-tools-mcp 0.9.27 → 0.9.29
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/LICENSE +4 -4
- package/README.md +7 -6
- package/build/index.js +93 -98
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -68,13 +68,13 @@ WHEREAS the inherent sovereignty of tribal nations provides a constitutional and
|
|
|
68
68
|
Any use, reproduction, distribution, modification, adaptation, display, performance, transmission, or creation of derivative works based on this Work, whether in whole or in part, must prominently and accurately include the following citation and attribution in all associated materials, displays, publications, and metadata:
|
|
69
69
|
|
|
70
70
|
```bibtex
|
|
71
|
-
@misc{
|
|
71
|
+
@misc{<|repo_title|><|current_year=2025|>,
|
|
72
72
|
author/creator/steward = {ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians},
|
|
73
|
-
title/description = {
|
|
73
|
+
title/description = {<|repo_title|>},
|
|
74
74
|
type_of_work = {Indigenous digital creation/software incorporating traditional knowledge and cultural expressions},
|
|
75
|
-
year = {
|
|
75
|
+
year = {<|current_year|>},
|
|
76
76
|
publisher/source/event = {GitHub repository under tribal sovereignty protections},
|
|
77
|
-
howpublished = {
|
|
77
|
+
howpublished = {\url{https://github.com/nbiish/<|repo_title|>}},
|
|
78
78
|
note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}
|
|
79
79
|
}
|
|
80
80
|
```
|
package/README.md
CHANGED
|
@@ -7,14 +7,11 @@
|
|
|
7
7
|
type_of_work = {Indigenous digital creation/software incorporating traditional knowledge and cultural expressions},
|
|
8
8
|
year = {2025},
|
|
9
9
|
publisher/source/event = {GitHub repository under tribal sovereignty protections},
|
|
10
|
-
howpublished = {
|
|
11
|
-
note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}
|
|
10
|
+
howpublished = {\url{https://github.com/nbiish/gikendaasowin-aabajichiganan-mcp}},
|
|
11
|
+
note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}
|
|
12
|
+
}
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
|
|
15
|
-
|
|
16
|
-
This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS](LICENSE).
|
|
17
|
-
|
|
18
15
|
<div align="center">
|
|
19
16
|
<hr width="50%">
|
|
20
17
|
|
|
@@ -33,6 +30,10 @@ This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR IND
|
|
|
33
30
|
<hr width="50%">
|
|
34
31
|
</div>
|
|
35
32
|
|
|
33
|
+
Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
|
|
34
|
+
|
|
35
|
+
This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS](LICENSE).
|
|
36
|
+
|
|
36
37
|
ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - 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 include advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment (`assess_cuc_n_mode`), context synthesis, confidence gauging, proactive planning, explicit reasoning (CoT), and reflection.
|
|
37
38
|
|
|
38
39
|
Known as:
|
package/build/index.js
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* -----------------------------------------------------------------------------
|
|
4
|
-
* Gikendaasowin Aabajichiganan - Core Cognitive Tools
|
|
4
|
+
* Gikendaasowin Aabajichiganan - Core INTERNAL Cognitive Tools (v4)
|
|
5
5
|
*
|
|
6
|
-
* Description: Provides
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* the `think` tool as guided by the system prompt, not via separate tools.
|
|
11
|
-
* Validation on input content structure is removed. Tool results are
|
|
12
|
-
* returned as formatted Markdown. Versioning removed.
|
|
6
|
+
* Description: Provides a mandatory internal suite of cognitive tools for an AI
|
|
7
|
+
* agent, heavily emphasizing the `think` tool as the central reasoning
|
|
8
|
+
* engine, guided by SOTA prompting principles (structured thought, CoT).
|
|
9
|
+
* These tools are STRICTLY for internal deliberation and logging.
|
|
13
10
|
*
|
|
14
11
|
* Key Principles:
|
|
15
|
-
* 1. **
|
|
16
|
-
*
|
|
17
|
-
* 2. **
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* 5. **Traceability:** All tool inputs are logged for a complete record.
|
|
23
|
-
* 6. **Markdown Output:** Tool results are formatted as Markdown.
|
|
12
|
+
* 1. **Internal Use Only:** Tools (`assess_cuc_n_mode`, `think`, `quick_think`)
|
|
13
|
+
* are part of the agent's internal cognitive loop and MUST NOT be exposed to the user.
|
|
14
|
+
* 2. **Mandatory `think` Hub:** `think` is the required tool for all non-trivial
|
|
15
|
+
* analysis, planning, reasoning (CoT/CoD), reflection, and error handling.
|
|
16
|
+
* 3. **Structured Reasoning:** Prompts enforce structured input (OODReAct for `think`).
|
|
17
|
+
* 4. **Traceability:** All internal tool inputs are logged for debugging and analysis.
|
|
18
|
+
* 5. **Log Output:** Tools return their input formatted as a Markdown log entry.
|
|
24
19
|
*
|
|
25
20
|
* Protocol: Model Context Protocol (MCP) over stdio.
|
|
26
21
|
* -----------------------------------------------------------------------------
|
|
@@ -30,147 +25,151 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
30
25
|
import { z } from "zod";
|
|
31
26
|
// --- Server Definition ---
|
|
32
27
|
const serverInfo = {
|
|
33
|
-
name: "gikendaasowin-aabajichiganan-mcp",
|
|
34
|
-
version: "
|
|
35
|
-
|
|
36
|
-
description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite (Ultra-Simplified): Focuses on Assess/Think loop. CoT/CoD styles are integrated into 'think'. Returns Markdown.`
|
|
28
|
+
name: "gikendaasowin-aabajichiganan-mcp-internal", // Keep internal marker
|
|
29
|
+
version: "4.0.0", // Increment version
|
|
30
|
+
description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core INTERNAL Cognitive Tools Suite (v4): MANDATORY Assess/Think loop for internal reasoning ONLY. Enforces structured 'think' via OODReAct. Returns internal Markdown log.`
|
|
37
31
|
};
|
|
38
32
|
const server = new McpServer(serverInfo);
|
|
39
33
|
// --- Logging Helpers ---
|
|
40
34
|
/**
|
|
41
|
-
* Logs an incoming tool call to stderr.
|
|
42
|
-
* @param toolName The name of the tool being called.
|
|
35
|
+
* Logs an incoming INTERNAL tool call to stderr.
|
|
36
|
+
* @param toolName The name of the internal tool being called.
|
|
43
37
|
* @param details Optional additional details about the call.
|
|
44
38
|
*/
|
|
45
39
|
function logToolCall(toolName, details) {
|
|
46
40
|
const timestamp = new Date().toISOString();
|
|
47
|
-
console.error(`[${timestamp}] [MCP Server] > Tool Call: ${toolName}${details ? ` - ${details}` : ''}`);
|
|
41
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] > Tool Call: ${toolName}${details ? ` - ${details}` : ''}`);
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
50
|
-
* Logs the result (success or failure) of
|
|
51
|
-
* @param toolName The name of the tool executed.
|
|
44
|
+
* Logs the result (success or failure) of an INTERNAL tool execution to stderr.
|
|
45
|
+
* @param toolName The name of the internal tool executed.
|
|
52
46
|
* @param success Whether the execution was successful.
|
|
53
47
|
* @param resultDetails Optional details about the result.
|
|
54
48
|
*/
|
|
55
49
|
function logToolResult(toolName, success, resultDetails) {
|
|
56
50
|
const timestamp = new Date().toISOString();
|
|
57
|
-
console.error(`[${timestamp}] [MCP Server] < Tool Result: ${toolName} - ${success ? 'Success' : 'Failure'}${resultDetails ? ` - ${resultDetails}` : ''}`);
|
|
51
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] < Tool Result: ${toolName} - ${success ? 'Success' : 'Failure'}${resultDetails ? ` - ${resultDetails}` : ''}`);
|
|
58
52
|
}
|
|
59
53
|
/**
|
|
60
|
-
* Logs an error during tool execution and formats
|
|
61
|
-
*
|
|
54
|
+
* Logs an error during INTERNAL tool execution and formats an error response for the LLM.
|
|
55
|
+
* Guides the LLM to use the 'think' tool for analysis.
|
|
56
|
+
* @param toolName The name of the internal tool where the error occurred.
|
|
62
57
|
* @param error The error object or message.
|
|
63
58
|
* @returns An object matching the required MCP tool result structure containing the error message.
|
|
64
59
|
*/
|
|
65
60
|
function logToolError(toolName, error) {
|
|
66
61
|
const timestamp = new Date().toISOString();
|
|
67
62
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
68
|
-
console.error(`[${timestamp}] [MCP Server] ! Tool Error: ${toolName} - ${errorMessage}`);
|
|
69
|
-
logToolResult(toolName, false, errorMessage); // Log failure result
|
|
70
|
-
// Return a structured error message
|
|
63
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] ! Tool Error: ${toolName} - ${errorMessage}`);
|
|
64
|
+
logToolResult(toolName, false, errorMessage); // Log failure result
|
|
65
|
+
// Return a structured error message guiding the next internal step
|
|
71
66
|
return {
|
|
72
67
|
content: [{
|
|
73
68
|
type: "text",
|
|
74
|
-
|
|
69
|
+
// Explicitly direct the next step to be analysis via 'think'
|
|
70
|
+
text: `INTERNAL Tool Execution Failed:\nTool: ${toolName}\nError: ${errorMessage}\n\n**Action Required: Immediately use the 'think' tool to analyze this failure (Observe, Orient, Decide, Reason...) before proceeding.**`
|
|
75
71
|
}]
|
|
76
72
|
};
|
|
77
73
|
}
|
|
78
|
-
// --- Core Cognitive Deliberation & Refinement Tools ---
|
|
74
|
+
// --- Core INTERNAL Cognitive Deliberation & Refinement Tools ---
|
|
79
75
|
/**
|
|
80
|
-
* Tool: assess_cuc_n_mode
|
|
81
|
-
* Purpose:
|
|
82
|
-
* Workflow: Call BEFORE starting
|
|
83
|
-
* Output: Returns the
|
|
76
|
+
* Tool: assess_cuc_n_mode (Internal Pre-computation)
|
|
77
|
+
* Purpose: Mandatory internal assessment of task CUC-N to determine required cognitive depth and select the next internal tool (`think` or `quick_think`).
|
|
78
|
+
* Workflow: Call internally BEFORE starting any non-trivial task or request. Output selection is binding.
|
|
79
|
+
* Output: Returns the assessment text formatted as Markdown log, confirming the mandatory next internal step.
|
|
84
80
|
*/
|
|
85
|
-
server.tool("assess_cuc_n_mode", "**Initial Assessment
|
|
86
|
-
assessment_and_choice: z.string().
|
|
81
|
+
server.tool("assess_cuc_n_mode", "**INTERNAL Use Only.** Mandatory Initial Assessment. Evaluates task CUC-N. MUST explicitly state 'Selected Mode: think' or 'Selected Mode: quick_think' which dictates the required next internal step. This assessment guides internal processing ONLY.", {
|
|
82
|
+
assessment_and_choice: z.string().min(1, "Assessment cannot be empty.") // Ensure non-empty
|
|
83
|
+
.includes("Selected Mode:", { message: "Assessment MUST include 'Selected Mode: think' or 'Selected Mode: quick_think'." }) // Enforce selection presence
|
|
84
|
+
.describe("Your internal structured CUC-N assessment (Situation, Ratings, Rationale, Strategy) concluding with the MANDATORY 'Selected Mode: think' or 'Selected Mode: quick_think' line. This dictates the next internal tool call.")
|
|
87
85
|
}, async ({ assessment_and_choice }) => {
|
|
88
86
|
const toolName = 'assess_cuc_n_mode';
|
|
89
87
|
logToolCall(toolName);
|
|
90
88
|
try {
|
|
91
|
-
//
|
|
89
|
+
// Zod validation now handles non-empty and presence of "Selected Mode:"
|
|
92
90
|
const modeRegex = /Selected Mode: (think|quick_think)/i;
|
|
93
91
|
const modeMatch = assessment_and_choice.match(modeRegex);
|
|
94
|
-
|
|
95
|
-
// Ensure assessment_and_choice is a non-empty string
|
|
96
|
-
if (assessment_and_choice.trim().length === 0) {
|
|
97
|
-
throw new Error('Invalid assessment_and_choice: Must be a non-empty string.');
|
|
98
|
-
}
|
|
92
|
+
// We rely on Zod to ensure modeMatch is not null due to .includes check, but double-check for robustness
|
|
99
93
|
if (!modeMatch) {
|
|
100
|
-
|
|
101
|
-
throw new Error('Invalid assessment: String must include explicit "Selected Mode: think" or "Selected Mode: quick_think".');
|
|
94
|
+
throw new Error("Internal validation failed: 'Selected Mode:' found but couldn't extract 'think' or 'quick_think'. Input was: " + assessment_and_choice);
|
|
102
95
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${assessment_and_choice}`);
|
|
106
|
-
// Return the
|
|
96
|
+
const selectedMode = modeMatch[1].toLowerCase();
|
|
97
|
+
logToolResult(toolName, true, `Mandatory next internal mode: ${selectedMode}`);
|
|
98
|
+
console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${assessment_and_choice}`);
|
|
99
|
+
// Return the assessment text as a log/confirmation
|
|
107
100
|
return {
|
|
108
101
|
content: [{
|
|
109
102
|
type: "text",
|
|
110
|
-
|
|
103
|
+
// Clarify the output's purpose
|
|
104
|
+
text: `Internal CUC-N Assessment Logged. Mandatory Next Step: ${selectedMode}\n---\nAssessment Details:\n${assessment_and_choice}`
|
|
111
105
|
}]
|
|
112
106
|
};
|
|
113
107
|
}
|
|
114
108
|
catch (error) {
|
|
109
|
+
// Catch Zod errors or other exceptions
|
|
115
110
|
return logToolError(toolName, error);
|
|
116
111
|
}
|
|
117
112
|
});
|
|
118
113
|
/**
|
|
119
|
-
* Tool: think
|
|
120
|
-
* Purpose: The **
|
|
121
|
-
* Workflow:
|
|
122
|
-
* Output: Returns the structured thought text itself
|
|
114
|
+
* Tool: think (Primary Internal Reasoning Engine - MANDATORY HUB)
|
|
115
|
+
* Purpose: The **central, mandatory hub** for ALL significant internal cognitive work (analysis, planning, CoT/CoD reasoning, reflection, error handling). Internal use ONLY.
|
|
116
|
+
* Workflow: Use whenever required by `assess_cuc_n_mode`, after receiving non-trivial tool results/errors, or before complex external actions. MUST follow OODReAct structure.
|
|
117
|
+
* Output: Returns the structured thought text itself as a Markdown log entry.
|
|
123
118
|
*/
|
|
124
|
-
server.tool("think", "**Central Hub for
|
|
125
|
-
thought: z.string().
|
|
119
|
+
server.tool("think", "**INTERNAL Use Only. Mandatory Central Hub for Reasoning.** Use for ALL internal analysis, planning, CoT/CoD reasoning, reflection, error handling. MUST use OODReAct structure (Observe, Orient, Decide, Reason, Act, Verification, Risk, Learning).", {
|
|
120
|
+
thought: z.string().min(10, "Thought must contain substantive reasoning.") // Require minimum length
|
|
121
|
+
// Enforce presence of key OODReAct sections for structure
|
|
122
|
+
.includes("## Observe:", { message: "Thought MUST include '## Observe:' section." })
|
|
123
|
+
.includes("## Orient:", { message: "Thought MUST include '## Orient:' section." })
|
|
124
|
+
.includes("## Decide:", { message: "Thought MUST include '## Decide:' section." })
|
|
125
|
+
.includes("## Reason:", { message: "Thought MUST include '## Reason:' section where CoT/CoD happens." })
|
|
126
|
+
// Add more checks as needed (Act, Verification, etc.) if strict enforcement is desired
|
|
127
|
+
// .includes("## Act:", "Thought MUST include '## Act:' section.")
|
|
128
|
+
// .includes("## Verification:", "Thought MUST include '## Verification:' section.")
|
|
129
|
+
// .includes("## Risk & Contingency:", "Thought MUST include '## Risk & Contingency:' section.")
|
|
130
|
+
// .includes("## Learning & Adaptation:", "Thought MUST include '## Learning & Adaptation:' section.")
|
|
131
|
+
.describe("Your **detailed internal monologue** STRICTLY following the OODReAct structure. Cover analysis (Observe), context (Orient), next step (Decide), detailed rationale/CoT/CoD (Reason), execution plan (Act), success checks (Verification), risks (Risk), and learning (Learning). This is purely for internal reasoning.")
|
|
126
132
|
}, async ({ thought }) => {
|
|
127
133
|
const toolName = 'think';
|
|
128
134
|
logToolCall(toolName);
|
|
129
135
|
try {
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
logToolResult(toolName, true, `Thought logged (length: ${thought.length})`);
|
|
135
|
-
// Log full input for traceability
|
|
136
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${thought}`);
|
|
137
|
-
// Returns the same thought text received, now without markdown wrappers
|
|
136
|
+
// Zod validation handles non-empty and key section presence checks
|
|
137
|
+
logToolResult(toolName, true, `Internal thought logged (length: ${thought.length})`);
|
|
138
|
+
console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${thought}`);
|
|
139
|
+
// Return the thought text as a log entry
|
|
138
140
|
return {
|
|
139
141
|
content: [{
|
|
140
142
|
type: "text",
|
|
141
|
-
text: thought //
|
|
143
|
+
text: `Internal Thought Logged (OODReAct Structure):\n---\n${thought}` // Added prefix and structure reminder
|
|
142
144
|
}]
|
|
143
145
|
};
|
|
144
146
|
}
|
|
145
147
|
catch (error) {
|
|
146
|
-
// Use logToolError to format the error for the LLM
|
|
147
148
|
return logToolError(toolName, error);
|
|
148
149
|
}
|
|
149
150
|
});
|
|
150
151
|
/**
|
|
151
|
-
* Tool: quick_think
|
|
152
|
-
* Purpose:
|
|
153
|
-
* Workflow: Use ONLY when
|
|
154
|
-
* Output: Returns the brief thought
|
|
152
|
+
* Tool: quick_think (Internal Trivial Checkpoint - RARE USE)
|
|
153
|
+
* Purpose: An internal-only lightweight confirmation step for unambiguously trivial situations assessed as Low CUC-N.
|
|
154
|
+
* Workflow: Use EXTREMELY SPARINGLY, ONLY when explicitly selected by `assess_cuc_n_mode` for trivial confirmations. Default to `think`.
|
|
155
|
+
* Output: Returns the brief thought text as a Markdown log entry.
|
|
155
156
|
*/
|
|
156
|
-
server.tool("quick_think", "**
|
|
157
|
-
brief_thought: z.string().
|
|
157
|
+
server.tool("quick_think", "**INTERNAL Use Only. Trivial Confirmation Checkpoint.** Use EXTREMELY SPARINGLY, ONLY for acknowledging trivial success when explicitly permitted by prior 'assess_cuc_n_mode' (Low CUC-N). Any analysis requires 'think'.", {
|
|
158
|
+
brief_thought: z.string().min(1, "Brief thought cannot be empty.")
|
|
159
|
+
.max(200, "Brief thought should be concise (max 200 chars). Use 'think' for detail.") // Add max length
|
|
160
|
+
.describe("Your **concise internal** confirmation for a verified trivial step (e.g., 'Acknowledged trivial success: file read OK.'). Use ONLY when full deliberation via 'think' is explicitly unnecessary per assessment.")
|
|
158
161
|
}, async ({ brief_thought }) => {
|
|
159
162
|
const toolName = 'quick_think';
|
|
160
163
|
logToolCall(toolName);
|
|
161
164
|
try {
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
logToolResult(toolName, true, `Logged: ${brief_thought.substring(0, 80)}...`);
|
|
167
|
-
// Log full input for traceability
|
|
168
|
-
console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${brief_thought}`);
|
|
169
|
-
// Return the brief thought text, now without markdown wrappers
|
|
165
|
+
// Zod validation handles non-empty and max length
|
|
166
|
+
logToolResult(toolName, true, `Internal brief thought logged: ${brief_thought.substring(0, 80)}...`);
|
|
167
|
+
console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${brief_thought}`);
|
|
168
|
+
// Return the brief thought text as a log entry
|
|
170
169
|
return {
|
|
171
170
|
content: [{
|
|
172
171
|
type: "text",
|
|
173
|
-
text: brief_thought //
|
|
172
|
+
text: `Internal Quick Thought Logged:\n---\n${brief_thought}` // Added prefix
|
|
174
173
|
}]
|
|
175
174
|
};
|
|
176
175
|
}
|
|
@@ -178,21 +177,19 @@ server.tool("quick_think", "**Cognitive Checkpoint & Concise Drafter.** Use for
|
|
|
178
177
|
return logToolError(toolName, error);
|
|
179
178
|
}
|
|
180
179
|
});
|
|
181
|
-
// ---
|
|
182
|
-
// --- REMOVED chain_of_draft Tool ---
|
|
183
|
-
// --- Server Lifecycle and Error Handling ---
|
|
180
|
+
// --- Server Lifecycle and Error Handling --- (Keep existing shutdown, uncaughtException, unhandledRejection)
|
|
184
181
|
/**
|
|
185
182
|
* Gracefully shuts down the server.
|
|
186
183
|
*/
|
|
187
184
|
async function shutdown() {
|
|
188
|
-
console.error('\n[MCP Server] Shutting down gracefully...');
|
|
185
|
+
console.error('\n[MCP Server - INTERNAL] Shutting down gracefully...');
|
|
189
186
|
try {
|
|
190
187
|
await server.close();
|
|
191
|
-
console.error('[MCP Server] Server closed.');
|
|
188
|
+
console.error('[MCP Server - INTERNAL] Server closed.');
|
|
192
189
|
process.exit(0);
|
|
193
190
|
}
|
|
194
191
|
catch (err) {
|
|
195
|
-
console.error('[MCP Server] Error during shutdown:', err);
|
|
192
|
+
console.error('[MCP Server - INTERNAL] Error during shutdown:', err);
|
|
196
193
|
process.exit(1);
|
|
197
194
|
}
|
|
198
195
|
}
|
|
@@ -200,19 +197,17 @@ process.on('SIGINT', shutdown);
|
|
|
200
197
|
process.on('SIGTERM', shutdown);
|
|
201
198
|
process.on('uncaughtException', (error, origin) => {
|
|
202
199
|
const timestamp = new Date().toISOString();
|
|
203
|
-
console.error(`[${timestamp}] [MCP Server] FATAL: Uncaught Exception at: ${origin}`, error);
|
|
204
|
-
// Attempt graceful shutdown, but exit quickly if it fails
|
|
200
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] FATAL: Uncaught Exception at: ${origin}`, error);
|
|
205
201
|
shutdown().catch(() => process.exit(1));
|
|
206
202
|
});
|
|
207
203
|
process.on('unhandledRejection', (reason, promise) => {
|
|
208
204
|
const timestamp = new Date().toISOString();
|
|
209
|
-
console.error(`[${timestamp}] [MCP Server] FATAL: Unhandled Promise Rejection:`, reason);
|
|
210
|
-
// Attempt graceful shutdown, but exit quickly if it fails
|
|
205
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] FATAL: Unhandled Promise Rejection:`, reason);
|
|
211
206
|
shutdown().catch(() => process.exit(1));
|
|
212
207
|
});
|
|
213
208
|
// --- Start the Server ---
|
|
214
209
|
/**
|
|
215
|
-
* Initializes and starts the MCP server.
|
|
210
|
+
* Initializes and starts the MCP server for INTERNAL cognitive tools.
|
|
216
211
|
*/
|
|
217
212
|
async function main() {
|
|
218
213
|
try {
|
|
@@ -221,13 +216,13 @@ async function main() {
|
|
|
221
216
|
const border = '-----------------------------------------------------';
|
|
222
217
|
console.error(border);
|
|
223
218
|
console.error(` ${serverInfo.description}`);
|
|
224
|
-
|
|
225
|
-
console.error(' Status: Running on stdio, awaiting MCP requests...');
|
|
219
|
+
console.error(` Version: ${serverInfo.version}`);
|
|
220
|
+
console.error(' Status: Running on stdio, awaiting INTERNAL MCP requests...');
|
|
226
221
|
console.error(border);
|
|
227
222
|
}
|
|
228
223
|
catch (error) {
|
|
229
224
|
const timestamp = new Date().toISOString();
|
|
230
|
-
console.error(`[${timestamp}] [MCP Server] Fatal error during startup:`, error);
|
|
225
|
+
console.error(`[${timestamp}] [MCP Server - INTERNAL] Fatal error during startup:`, error);
|
|
231
226
|
process.exit(1);
|
|
232
227
|
}
|
|
233
228
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.29",
|
|
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",
|