@nbiish/cognitive-tools-mcp 0.7.3 → 0.8.1
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 +12 -8
- package/README.md +22 -9
- package/build/index.js +106 -101
- package/integration-prompts/integration-prompt-10.md +100 -0
- package/integration-tool-descriptions/tool-descriptions-04.ts +221 -0
- package/package.json +2 -2
- package/integration-tool-descriptions/tool-descriptions-03.md +0 -211
- /package/integration-tool-descriptions/{tool-descriptoins-03.ts → tool-descriptions-03.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -43,13 +43,13 @@ This license applies to 'the Work.' 'The Work' primarily encompasses the Indigen
|
|
|
43
43
|
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:
|
|
44
44
|
|
|
45
45
|
```bibtex
|
|
46
|
-
@misc{
|
|
46
|
+
@misc{<|repo_title|><|current_year|>,
|
|
47
47
|
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},
|
|
48
|
-
title/description = {
|
|
48
|
+
title/description = {<|repo_title|>},
|
|
49
49
|
type_of_work = {Indigenous digital creation/software incorporating traditional knowledge and cultural expressions},
|
|
50
|
-
year = {
|
|
50
|
+
year = {<|current_year|>},
|
|
51
51
|
publisher/source/event = {GitHub repository under tribal sovereignty protections},
|
|
52
|
-
howpublished = {\url{https://github.com/nbiish
|
|
52
|
+
howpublished = {\url{https://github.com/nbiish/<|repo_title|>}},
|
|
53
53
|
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 (whose community faced violent dispersal resulting in descendants affiliating with LTBB, GTBOCI, and First Nations in Canada, as detailed in the Preamble), an 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.}
|
|
54
54
|
}
|
|
55
55
|
```
|
|
@@ -608,9 +608,13 @@ This license applies to 'the Work.' 'The Work' primarily encompasses the Indigen
|
|
|
608
608
|
**11. DISPUTE RESOLUTION AND JURISDICTION**
|
|
609
609
|
The terms, interpretation, and enforcement of this license incorporate and are informed by tribal sovereignty principles, federal Indian law, traditional Indigenous law of the Grand Traverse Band of Ottawa and Chippewa Indians, and international Indigenous rights frameworks:
|
|
610
610
|
|
|
611
|
-
11.1 PRIMARY JURISDICTION: The
|
|
611
|
+
11.1 PRIMARY JURISDICTION HIERARCHY: The following jurisdictional hierarchy shall apply to any and all disputes arising under or related to this license, including but not limited to disputes concerning the interpretation or enforcement of protections for Traditional Knowledge (TK), Traditional Cultural Expressions (TCEs), Sacred Sites (including the stone circle on ᐋᒥᒃ ᐙᑲᓐᑕ / Aamik'Waakanda, land held in trust by GTBOCI), and Cultural Landscapes as defined herein:
|
|
612
|
+
|
|
613
|
+
a) BEAVER ISLAND BAND PRIORITY: If and when the Beaver Island Band (historically centered on ᐋᒥᒃ ᐙᑲᓐᑕ (Aamik'Waakanda / Beaver Island)) establishes its own tribal court, legal forum, or formalized dispute resolution body (whether through federal recognition, reorganization of descendants, or other means of formal establishment), such forum shall have primary and first jurisdiction over any and all disputes arising under or related to this license. Such forum shall incorporate both written and unwritten traditional and customary law in its adjudication, recognizing the paramount cultural significance of the subject matter to the Rights Holder and the Beaver Island Band.
|
|
614
|
+
|
|
615
|
+
b) GTBOCI JURISDICTION: If the forum described in 11.1(a) does not exist or is determined by its own authority to be unavailable or impractical for a specific dispute, the Grand Traverse Band of Ottawa and Chippewa Indians (GTBOCI) Tribal Court shall have primary and exclusive jurisdiction. The GTBOCI Tribal Court shall incorporate both written tribal law and unwritten traditional and customary law in its adjudication, recognizing the paramount cultural significance of the subject matter to the Rights Holder and the Tribe.
|
|
612
616
|
|
|
613
|
-
11.2 SECONDARY JURISDICTIONS AND RELATED TRIBAL INTERESTS: In circumstances where
|
|
617
|
+
11.2 SECONDARY JURISDICTIONS AND RELATED TRIBAL INTERESTS: In circumstances where proceedings in the forums specified in Section 11.1 are determined by those forums themselves to be unavailable or impractical for a specific dispute, or where enforcement of a tribal court judgment is sought in another forum, the following forums may have concurrent or subsequent jurisdiction, subject always to the principles of tribal sovereignty and exhaustion of tribal remedies. Furthermore, for disputes specifically concerning the Garden Island (Gitigaan Minising) burial grounds (land held in trust by LTBB), the jurisdictional interest and potential role of the Little Traverse Bay Bands of Odawa Indians shall be appropriately considered and respected within the dispute resolution process, consistent with principles of comity and inter-tribal relations:
|
|
614
618
|
a) The United States Federal District Court with geographic jurisdiction encompassing the lands of the Grand Traverse Band of Ottawa and Chippewa Indians, particularly for matters arising under federal Indian law or requiring interpretation of federal statutes or treaties.
|
|
615
619
|
b) If federal court jurisdiction is unavailable, the courts of the State of Michigan, solely to the extent necessary and permissible under federal Indian law and principles of comity, and provided that tribal law and perspectives are given appropriate weight.
|
|
616
620
|
c) For international disputes, the choice of forum and applicable law shall prioritize mechanisms that respect Indigenous sovereignty and international indigenous rights frameworks (e.g., WIPO procedures for TK/TCEs, application of lex originis principles), as determined appropriate by the Rights Holder.
|
|
@@ -639,9 +643,9 @@ This license applies to 'the Work.' 'The Work' primarily encompasses the Indigen
|
|
|
639
643
|
iii) This remedies allocation provision shall be interpreted and applied in a manner consistent with the tribal sovereignty principles articulated throughout this license and shall take precedence over any conflicting remedies provisions in applicable non-tribal law.
|
|
640
644
|
iv) Any attempt to circumvent this remedies allocation provision shall constitute a separate and severe violation of this license, triggering all available enforcement remedies.
|
|
641
645
|
|
|
642
|
-
11.7 EXHAUSTION REQUIREMENT: All parties to disputes arising under this license must fully exhaust tribal court remedies before seeking adjudication or enforcement in any non-tribal forum, consistent with the federal doctrine of exhaustion of tribal remedies (see National Farmers Union Ins. Cos. v. Crow Tribe, 471 U.S. 845 (1985); Iowa Mut. Ins. Co. v. LaPlante, 480 U.S. 9 (1987)).
|
|
646
|
+
11.7 EXHAUSTION REQUIREMENT: All parties to disputes arising under this license must fully exhaust tribal court remedies before seeking adjudication or enforcement in any non-tribal forum, consistent with the federal doctrine of exhaustion of tribal remedies (see National Farmers Union Ins. Cos. v. Crow Tribe, 471 U.S. 845 (1985); Iowa Mut. Ins. Co. v. LaPlante, 480 U.S. 9 (1987)). This specifically requires exhaustion of remedies in the Beaver Island Band forum (if established pursuant to Section 11.1(a)) and/or the GTBOCI Tribal Court (pursuant to Section 11.1(b)) as applicable under the jurisdictional hierarchy established in Section 11.1.
|
|
643
647
|
|
|
644
|
-
11.8 JURISDICTIONAL CHALLENGES: Any challenge to the jurisdiction of the GTBOCI Tribal Court must be raised exclusively within that
|
|
648
|
+
11.8 JURISDICTIONAL CHALLENGES: Any challenge to the jurisdiction of the Beaver Island Band forum (established pursuant to Section 11.1(a)) or the GTBOCI Tribal Court must be raised exclusively within that respective forum in the first instance, and that forum's determination of its jurisdiction shall be given substantial deference in all subsequent proceedings in any forum.
|
|
645
649
|
|
|
646
650
|
11.9 ENFORCEMENT COSTS: In addition to any other remedies available under this license, tribal law, federal Indian law, or other applicable law, any party found to be in breach of any term or condition of this license by a competent forum pursuant to Section 11 shall be liable for and shall pay to the Rights Holder (or their designated successor or the Trust established under Section 10.3, consistent with the allocation provisions of Section 11.6.d) all reasonable costs incurred in enforcing the terms of this license. Such costs include, but are not limited to, reasonable attorneys\' fees, court costs, investigation expenses (including digital forensics costs pursuant to Section 9A.7 where applicable), expert witness fees, and any other expenses directly related to addressing the breach and securing compliance. This provision for cost recovery shall not be limited by Section 14 (Limitation of Liability).
|
|
647
651
|
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<hr width="50%">
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.
|
|
21
|
+
ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.1): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.0+. Enforces mandatory structured deliberation via `think` after explicit assessment. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis, optimizing for cognitive enhancement. 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.
|
|
22
22
|
|
|
23
23
|
Known as:
|
|
24
24
|
- Anishinaabemowin: [`@nbiish/gikendaasowin-aabajichiganan-mcp`](https://www.npmjs.com/package/@nbiish/gikendaasowin-aabajichiganan-mcp)
|
|
@@ -85,30 +85,41 @@ Or:
|
|
|
85
85
|
{
|
|
86
86
|
"content": [{
|
|
87
87
|
"type": "text",
|
|
88
|
-
"text": "
|
|
88
|
+
"text": "Returns the complete thought content you provided for explicit grounding in the next step"
|
|
89
89
|
}]
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### Chain of Thought Tool
|
|
94
94
|
- **Purpose**: Generate explicit, sequential reasoning steps for problem-solving
|
|
95
|
-
- **Input**:
|
|
96
|
-
-
|
|
95
|
+
- **Input**:
|
|
96
|
+
- `generated_cot_text` (string) - The full, step-by-step Chain of Thought text you generated internally
|
|
97
|
+
- `problem_statement` (string) - The original problem statement this CoT addresses
|
|
98
|
+
- **Response Format**: Returns the complete CoT text for mandatory analysis in the next step
|
|
97
99
|
|
|
98
100
|
### Reflection Tool
|
|
99
101
|
- **Purpose**: Self-critique and improvement of reasoning or plans
|
|
100
|
-
- **Input**:
|
|
101
|
-
-
|
|
102
|
+
- **Input**:
|
|
103
|
+
- `generated_critique_text` (string) - The full critique text you generated internally
|
|
104
|
+
- `input_reasoning_or_plan` (string) - The original text that was critiqued
|
|
105
|
+
- **Response Format**: Returns the complete critique text for mandatory analysis in the next step
|
|
102
106
|
|
|
103
107
|
### Plan and Solve Tool
|
|
104
108
|
- **Purpose**: High-level strategy development for complex objectives
|
|
105
|
-
- **Input**:
|
|
106
|
-
-
|
|
109
|
+
- **Input**:
|
|
110
|
+
- `generated_plan_text` (string) - The full, structured plan text you generated internally
|
|
111
|
+
- `task_objective` (string) - The original high-level task objective this plan addresses
|
|
112
|
+
- **Response Format**: Returns the complete plan text for mandatory analysis in the next step
|
|
107
113
|
|
|
108
114
|
### Chain of Draft Tool
|
|
109
115
|
- **Purpose**: Concise, iterative reasoning steps for rapid exploration
|
|
110
116
|
- **Input**: `problem_statement` (string) - Problem suitable for concise, iterative reasoning
|
|
111
|
-
- **Response Format**:
|
|
117
|
+
- **Response Format**: Returns a confirmation message; the drafts you generated internally must be analyzed in the next step
|
|
118
|
+
|
|
119
|
+
### Mandatory Pre-Deliberation Assessment
|
|
120
|
+
- **Purpose**: Must be called BEFORE every `think` or `quick_think`. Evaluates CUC-N, recommends strategy, commits to next thought mode.
|
|
121
|
+
- **Input**: `assessment_and_choice` (string) - Your assessment including Situation Description, CUC-N Ratings, Recommended Strategy, and Selected Mode
|
|
122
|
+
- **Response Format**: Returns confirmation with the selected mode
|
|
112
123
|
|
|
113
124
|
## Development
|
|
114
125
|
|
|
@@ -204,6 +215,8 @@ Example Response:
|
|
|
204
215
|
|
|
205
216
|
## Version History
|
|
206
217
|
|
|
218
|
+
- **0.8.1**: Version sync update for both packages with identical functionality to v0.8.0, ensuring consistent versioning
|
|
219
|
+
- **0.8.0**: Updated tool function design to return generated content for explicit analysis, renamed `assess_cuc_n` to `assess_cuc_n_mode`, aligned with AI Pair Programmer Prompt v0.8.0+
|
|
207
220
|
- **0.7.3**: Improved dual package publishing with automated scripts, consistent versioning, and documentation updates
|
|
208
221
|
- **0.7.2**: Updated tool names for length constraints (`assess_complexity_and_select_thought_mode` → `assess_cuc_n`), improved dual package publishing support, and aligned with AI Pair Programmer Prompt v0.7.2
|
|
209
222
|
- **0.7.1**: Updated to align with AI Pair Programmer Prompt v0.7.1+, renamed `assess_cuc_n_mode` to `assess_cuc_n`, enhanced cognitive tools for more explicit handling of tool needs
|
package/build/index.js
CHANGED
|
@@ -2,77 +2,61 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
// Create the MCP server
|
|
5
|
+
// Create the MCP server - Version 0.8.0 reflects the change in tool signatures and return values
|
|
6
6
|
const server = new McpServer({
|
|
7
7
|
name: "gikendaasowin-aabajichiganan-mcp",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.7.3): SOTA internal reasoning suite aligned with AI Pair Programmer Prompt v0.7.2. Enforces mandatory structured deliberation via `think` after explicit assessment. Includes meta-cognition, context synthesis, proactive planning, CoT, reflection, and tool awareness."
|
|
8
|
+
version: "0.8.0", // Updated version
|
|
9
|
+
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.0): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.0+. Enforces mandatory structured deliberation via `think` after explicit assessment. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis, optimizing for cognitive enhancement."
|
|
11
10
|
});
|
|
12
11
|
// --- Core Cognitive Deliberation Tools ---
|
|
13
12
|
server.tool("think",
|
|
14
|
-
// Main Description:
|
|
15
|
-
"MANDATORY Cognitive Hub for
|
|
16
|
-
// Parameter Description:
|
|
17
|
-
thought: z.string().describe("Your **detailed** internal monologue
|
|
13
|
+
// Main Description: Central hub, now returns the thought for explicit context.
|
|
14
|
+
"MANDATORY Cognitive Hub for Medium/High CUC-N situations. Analyzes inputs/prior steps, plans, verifies, assesses risks, self-corrects. Returns the detailed thought text for explicit grounding in the next step.", {
|
|
15
|
+
// Parameter Description: Input IS the thought.
|
|
16
|
+
thought: z.string().describe("Your **detailed** internal monologue following the MANDATORY structure: ## Analysis, ## Plan, ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
18
17
|
}, async ({ thought }) => {
|
|
19
18
|
if (!thought || typeof thought !== 'string' || thought.trim().length === 0) {
|
|
20
19
|
throw new Error('Invalid thought: Must be non-empty, structured reasoning.');
|
|
21
20
|
}
|
|
22
|
-
console.error(`[CognitiveToolsServer v0.
|
|
23
|
-
//
|
|
24
|
-
return { content: [{ type: "text", text:
|
|
21
|
+
console.error(`[CognitiveToolsServer v0.8.0] Think Tool Received: ${thought.substring(0, 150)}...`);
|
|
22
|
+
// Returns the same thought text received, making it explicit in context.
|
|
23
|
+
return { content: [{ type: "text", text: thought }] };
|
|
25
24
|
});
|
|
26
25
|
server.tool("quick_think",
|
|
27
|
-
// Main Description:
|
|
28
|
-
"Cognitive Checkpoint ONLY for situations explicitly assessed as
|
|
29
|
-
|
|
30
|
-
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations (e.g., 'Acknowledged user input.', 'Proceeding with confirmed step 3.', 'Code execution successful.').")
|
|
26
|
+
// Main Description: Unchanged - simple confirmation is sufficient here.
|
|
27
|
+
"Cognitive Checkpoint ONLY for situations explicitly assessed as strictly Low CUC-N AND simple task nature. Use sparingly. Logs brief thought.", {
|
|
28
|
+
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment.")
|
|
31
29
|
}, async ({ brief_thought }) => {
|
|
32
30
|
if (!brief_thought || typeof brief_thought !== 'string' || brief_thought.trim().length === 0) {
|
|
33
31
|
throw new Error('Invalid brief_thought: Must be non-empty.');
|
|
34
32
|
}
|
|
35
|
-
console.error(`[CognitiveToolsServer v0.
|
|
36
|
-
//
|
|
33
|
+
console.error(`[CognitiveToolsServer v0.8.0] QuickThink Tool Logged: ${brief_thought.substring(0, 100)}...`);
|
|
34
|
+
// Simple confirmation remains appropriate for quick_think.
|
|
37
35
|
return { content: [{ type: "text", text: `Quick Thought logged successfully.` }] };
|
|
38
36
|
});
|
|
39
|
-
// ---
|
|
40
|
-
server.tool("
|
|
41
|
-
// Main Description:
|
|
42
|
-
"**Mandatory Pre-
|
|
43
|
-
// Parameter Description:
|
|
44
|
-
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation
|
|
37
|
+
// --- Mandatory Meta-Cognitive Tools (Responses remain concise confirmations) ---
|
|
38
|
+
server.tool("assess_cuc_n_mode",
|
|
39
|
+
// Main Description: Unchanged.
|
|
40
|
+
"**Mandatory Pre-Deliberation Assessment.** Must be called BEFORE every `think` or `quick_think`. Evaluates CUC-N, recommends strategy, commits to next thought mode.", {
|
|
41
|
+
// Parameter Description: Unchanged.
|
|
42
|
+
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation Description, 2) CUC-N Ratings (L/M/H), 3) Recommended Initial Strategy, 4) Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').")
|
|
45
43
|
}, async ({ assessment_and_choice }) => {
|
|
46
|
-
// Enhanced validation to check for key phrases expected from the prompt's instructions
|
|
47
44
|
const requiredPhrases = ["Complexity", "Uncertainty", "Consequence", "Novelty", "Recommended Initial Strategy", "Selected Mode:"];
|
|
48
45
|
const hasRequiredPhrases = requiredPhrases.every(phrase => assessment_and_choice.includes(phrase));
|
|
49
46
|
const hasModeSelection = assessment_and_choice.includes("Selected Mode: think") || assessment_and_choice.includes("Selected Mode: quick_think");
|
|
50
47
|
if (!assessment_and_choice || typeof assessment_and_choice !== 'string' || !hasRequiredPhrases || !hasModeSelection) {
|
|
51
48
|
throw new Error('Invalid assessment: String must include CUC-N ratings, Recommended Initial Strategy, and explicit Selected Mode ("think" or "quick_think").');
|
|
52
49
|
}
|
|
53
|
-
console.error(`[CognitiveToolsServer v0.
|
|
50
|
+
console.error(`[CognitiveToolsServer v0.8.0] AssessComplexity Tool Signaled: ${assessment_and_choice.substring(0, 150)}...`);
|
|
54
51
|
const mode = assessment_and_choice.includes("Selected Mode: think") ? "think" : "quick_think";
|
|
55
|
-
//
|
|
52
|
+
// Confirmation guides the next step.
|
|
56
53
|
return { content: [{ type: "text", text: `Cognitive Assessment Completed. Proceeding with selected mode: ${mode}. Full Assessment: ${assessment_and_choice}` }] };
|
|
57
54
|
});
|
|
58
|
-
server.tool("synthesize_prior_reasoning",
|
|
59
|
-
// Main Description: Manages context window and focuses reasoning.
|
|
60
|
-
"Context Management Tool. Guides the LLM to **internally generate a structured summary text** of preceding lengthy reasoning, focusing on **`Key Decisions Made`** and **`Open Questions/Uncertainties`**. Used to manage context and refocus attention.", {
|
|
61
|
-
// Parameter Description: Reminds LLM of the required internal summary structure.
|
|
62
|
-
context_to_summarize_description: z.string().describe("Describe the reasoning span being summarized. *You* (LLM) must now *internally generate the structured summary text (including Key Decisions, Open Questions)* before calling. This signals the summary is ready for `think` analysis.")
|
|
63
|
-
}, async ({ context_to_summarize_description }) => {
|
|
64
|
-
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) {
|
|
65
|
-
throw new Error('Invalid context description: Must be non-empty.');
|
|
66
|
-
}
|
|
67
|
-
console.error(`[CognitiveToolsServer v0.7.3] SynthesizeReasoning Tool Signaled for: ${context_to_summarize_description}...`);
|
|
68
|
-
// Output implies structured summary is ready for analysis.
|
|
69
|
-
return { content: [{ type: "text", text: `Structured synthesis internally generated for context: '${context_to_summarize_description}'. Ready for detailed analysis in next 'think' step.` }] };
|
|
70
|
-
});
|
|
71
55
|
server.tool("gauge_confidence",
|
|
72
|
-
// Main Description:
|
|
73
|
-
"Meta-Cognitive Checkpoint. Guides
|
|
74
|
-
// Parameter Description:
|
|
75
|
-
assessment_and_confidence: z.string().describe("Input
|
|
56
|
+
// Main Description: Unchanged.
|
|
57
|
+
"Meta-Cognitive Checkpoint. Guides internal stating of **confidence (High/Medium/Low) and justification**. Output MUST be analyzed in the mandatory `think` step immediately after; Low/Medium confidence requires specific action planning.", {
|
|
58
|
+
// Parameter Description: Unchanged.
|
|
59
|
+
assessment_and_confidence: z.string().describe("Input item being assessed. *Internally determine and state*: 1) Confidence Level (H/M/L). 2) Justification. Call this tool *after* making the assessment.")
|
|
76
60
|
}, async ({ assessment_and_confidence }) => {
|
|
77
61
|
const confidenceRegex = /Confidence Level: (High|Medium|Low)/i;
|
|
78
62
|
if (!assessment_and_confidence || typeof assessment_and_confidence !== 'string' || !confidenceRegex.test(assessment_and_confidence)) {
|
|
@@ -80,92 +64,113 @@ server.tool("gauge_confidence",
|
|
|
80
64
|
}
|
|
81
65
|
const match = assessment_and_confidence.match(confidenceRegex);
|
|
82
66
|
const level = match ? match[1] : "Unknown";
|
|
83
|
-
console.error(`[CognitiveToolsServer v0.
|
|
84
|
-
//
|
|
85
|
-
return { content: [{ type: "text", text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory 'think' analysis (action required if Low/Medium).` }] };
|
|
67
|
+
console.error(`[CognitiveToolsServer v0.8.0] GaugeConfidence Tool Signaled: Level ${level}`);
|
|
68
|
+
// Confirmation includes level, prepares for mandatory analysis.
|
|
69
|
+
return { content: [{ type: "text", text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory post-assessment 'think' analysis (action required if Low/Medium).` }] };
|
|
86
70
|
});
|
|
87
|
-
// --- Supporting Cognitive Strategy Tools ---
|
|
71
|
+
// --- Supporting Cognitive Strategy Tools (Now Accept & Return Generated Text) ---
|
|
88
72
|
server.tool("plan_and_solve",
|
|
89
|
-
// Main Description:
|
|
90
|
-
"Guides
|
|
91
|
-
// Parameter
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
// Main Description: Now returns the plan text itself.
|
|
74
|
+
"Guides internal generation of **structured plan text** (incl. Risks/Challenges, potential tool needs). Call this tool *with* the generated plan text. Returns the plan text for mandatory `think` analysis.", {
|
|
75
|
+
// NEW Parameter: Accepts the generated plan.
|
|
76
|
+
generated_plan_text: z.string().describe("The **full, structured plan text** you generated internally, including Anticipated Challenges/Risks and potential other tool needs."),
|
|
77
|
+
task_objective: z.string().describe("The original high-level task objective this plan addresses.") // Keep original objective for context logging.
|
|
78
|
+
}, async ({ generated_plan_text, task_objective }) => {
|
|
79
|
+
if (!generated_plan_text || typeof generated_plan_text !== 'string' || generated_plan_text.trim().length === 0) {
|
|
80
|
+
throw new Error('Invalid generated_plan_text: Must be non-empty.');
|
|
81
|
+
}
|
|
94
82
|
if (!task_objective || typeof task_objective !== 'string' || task_objective.trim().length === 0) {
|
|
95
|
-
throw new Error('Invalid
|
|
83
|
+
throw new Error('Invalid task_objective.');
|
|
96
84
|
}
|
|
97
|
-
console.error(`[CognitiveToolsServer v0.
|
|
98
|
-
//
|
|
99
|
-
return { content: [{ type: "text", text:
|
|
85
|
+
console.error(`[CognitiveToolsServer v0.8.0] PlanAndSolve Tool Received Plan for Objective: ${task_objective.substring(0, 100)}...`);
|
|
86
|
+
// Returns the actual plan text received.
|
|
87
|
+
return { content: [{ type: "text", text: generated_plan_text }] };
|
|
100
88
|
});
|
|
101
89
|
server.tool("chain_of_thought",
|
|
102
|
-
// Main Description:
|
|
103
|
-
"Guides
|
|
104
|
-
// Parameter
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
// Main Description: Now returns the CoT text itself.
|
|
91
|
+
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. Call this tool *with* the generated CoT text. Returns the CoT text for mandatory `think` analysis.", {
|
|
92
|
+
// NEW Parameter: Accepts the generated CoT.
|
|
93
|
+
generated_cot_text: z.string().describe("The **full, step-by-step Chain of Thought text** you generated internally, potentially noting needs for other tools."),
|
|
94
|
+
problem_statement: z.string().describe("The original problem statement this CoT addresses.") // Keep original problem statement for context logging.
|
|
95
|
+
}, async ({ generated_cot_text, problem_statement }) => {
|
|
96
|
+
if (!generated_cot_text || typeof generated_cot_text !== 'string' || generated_cot_text.trim().length === 0) {
|
|
97
|
+
throw new Error('Invalid generated_cot_text: Must be non-empty.');
|
|
98
|
+
}
|
|
109
99
|
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) {
|
|
110
|
-
throw new Error('Invalid
|
|
100
|
+
throw new Error('Invalid problem_statement.');
|
|
111
101
|
}
|
|
112
|
-
console.error(`[CognitiveToolsServer v0.
|
|
113
|
-
//
|
|
114
|
-
return { content: [{ type: "text", text:
|
|
102
|
+
console.error(`[CognitiveToolsServer v0.8.0] ChainOfThought Tool Received CoT for Problem: ${problem_statement.substring(0, 100)}...`);
|
|
103
|
+
// Returns the actual CoT text received.
|
|
104
|
+
return { content: [{ type: "text", text: generated_cot_text }] };
|
|
115
105
|
});
|
|
116
106
|
server.tool("chain_of_draft",
|
|
117
|
-
// Main Description:
|
|
118
|
-
"Guides
|
|
119
|
-
// Parameter
|
|
120
|
-
problem_statement: z.string().describe("Input
|
|
121
|
-
},
|
|
122
|
-
// Implementation: Signals Drafting was performed.
|
|
123
|
-
async ({ problem_statement }) => {
|
|
107
|
+
// Main Description: Keeping as signal due to complexity of multiple drafts. Response reinforces next step.
|
|
108
|
+
"Guides internal generation of **concise, iterative reasoning draft texts**. Call this tool *after* generating drafts internally. Response confirms generation; drafts MUST be analyzed via mandatory `think`.", {
|
|
109
|
+
// Parameter: Still just the problem statement. LLM handles drafts internally.
|
|
110
|
+
problem_statement: z.string().describe("Input problem for exploration. *You* (LLM) must now *internally generate brief, iterative draft texts*. Call this tool *after* generation to signal readiness for analysis.")
|
|
111
|
+
}, async ({ problem_statement }) => {
|
|
124
112
|
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) {
|
|
125
113
|
throw new Error('Invalid problem statement.');
|
|
126
114
|
}
|
|
127
|
-
console.error(`[CognitiveToolsServer v0.
|
|
128
|
-
//
|
|
129
|
-
return { content: [{ type: "text", text: `Reasoning drafts internally
|
|
115
|
+
console.error(`[CognitiveToolsServer v0.8.0] ChainOfDraft Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
116
|
+
// Returns confirmation, strongly reminding LLM of the mandatory next step.
|
|
117
|
+
return { content: [{ type: "text", text: `Reasoning drafts generated internally for problem: ${problem_statement}. MANDATORY: Analyze these drafts now in your next post-assessment 'think' step.` }] };
|
|
130
118
|
});
|
|
131
119
|
server.tool("reflection",
|
|
132
|
-
// Main Description:
|
|
133
|
-
"Guides
|
|
134
|
-
// Parameter
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
// Main Description: Now returns the critique text itself.
|
|
121
|
+
"Guides internal critical self-evaluation on prior text. Call this tool *with* the **generated critique text**. Returns the critique text for mandatory `think` analysis.", {
|
|
122
|
+
// NEW Parameter: Accepts the generated critique.
|
|
123
|
+
generated_critique_text: z.string().describe("The **full critique text** you generated internally, identifying flaws and suggesting improvements."),
|
|
124
|
+
input_reasoning_or_plan: z.string().describe("The original text that was critiqued.") // Keep original text for context logging.
|
|
125
|
+
}, async ({ generated_critique_text, input_reasoning_or_plan }) => {
|
|
126
|
+
if (!generated_critique_text || typeof generated_critique_text !== 'string' || generated_critique_text.trim().length === 0) {
|
|
127
|
+
throw new Error('Invalid generated_critique_text: Must be non-empty.');
|
|
128
|
+
}
|
|
139
129
|
if (!input_reasoning_or_plan || typeof input_reasoning_or_plan !== 'string' || input_reasoning_or_plan.trim().length === 0) {
|
|
140
|
-
throw new Error('Invalid
|
|
130
|
+
throw new Error('Invalid input_reasoning_or_plan.');
|
|
141
131
|
}
|
|
142
|
-
console.error(`[CognitiveToolsServer v0.
|
|
143
|
-
//
|
|
144
|
-
return { content: [{ type: "text", text:
|
|
132
|
+
console.error(`[CognitiveToolsServer v0.8.0] Reflection Tool Received Critique for: ${input_reasoning_or_plan.substring(0, 100)}...`);
|
|
133
|
+
// Returns the actual critique text received.
|
|
134
|
+
return { content: [{ type: "text", text: generated_critique_text }] };
|
|
145
135
|
});
|
|
146
|
-
|
|
136
|
+
server.tool("synthesize_prior_reasoning",
|
|
137
|
+
// Main Description: Now returns the summary text itself.
|
|
138
|
+
"Context Management Tool. Guides internal generation of a **structured summary text** (incl. Key Decisions, Open Questions). Call this tool *with* the generated summary text. Returns the summary for mandatory `think` analysis.", {
|
|
139
|
+
// NEW Parameter: Accepts the generated summary.
|
|
140
|
+
generated_summary_text: z.string().describe("The **full, structured summary text** you generated internally."),
|
|
141
|
+
context_to_summarize_description: z.string().describe("Description of the reasoning span that was summarized.") // Keep description for context logging.
|
|
142
|
+
}, async ({ generated_summary_text, context_to_summarize_description }) => {
|
|
143
|
+
if (!generated_summary_text || typeof generated_summary_text !== 'string' || generated_summary_text.trim().length === 0) {
|
|
144
|
+
throw new Error('Invalid generated_summary_text: Must be non-empty.');
|
|
145
|
+
}
|
|
146
|
+
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) {
|
|
147
|
+
throw new Error('Invalid context_to_summarize_description.');
|
|
148
|
+
}
|
|
149
|
+
console.error(`[CognitiveToolsServer v0.8.0] SynthesizeReasoning Tool Received Summary for: ${context_to_summarize_description}...`);
|
|
150
|
+
// Returns the actual summary text received.
|
|
151
|
+
return { content: [{ type: "text", text: generated_summary_text }] };
|
|
152
|
+
});
|
|
153
|
+
// --- Server Lifecycle and Error Handling (Unchanged) ---
|
|
147
154
|
process.on('SIGINT', async () => {
|
|
148
|
-
console.error('\n[CognitiveToolsServer v0.
|
|
155
|
+
console.error('\n[CognitiveToolsServer v0.8.0] Received SIGINT, shutting down gracefully.');
|
|
149
156
|
await server.close();
|
|
150
157
|
process.exit(0);
|
|
151
158
|
});
|
|
152
159
|
process.on('SIGTERM', async () => {
|
|
153
|
-
console.error('\n[CognitiveToolsServer v0.
|
|
160
|
+
console.error('\n[CognitiveToolsServer v0.8.0] Received SIGTERM, shutting down gracefully.');
|
|
154
161
|
await server.close();
|
|
155
162
|
process.exit(0);
|
|
156
163
|
});
|
|
157
164
|
process.on('uncaughtException', (error) => {
|
|
158
|
-
console.error('[CognitiveToolsServer v0.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
process.exit(1); // Exit on fatal error
|
|
165
|
+
console.error('[CognitiveToolsServer v0.8.0] FATAL: Uncaught Exception:', error);
|
|
166
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.0] Error during shutdown on uncaughtException:', err)).finally(() => {
|
|
167
|
+
process.exit(1);
|
|
162
168
|
});
|
|
163
169
|
});
|
|
164
170
|
process.on('unhandledRejection', (reason, promise) => {
|
|
165
|
-
console.error('[CognitiveToolsServer v0.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
process.exit(1); // Exit on fatal error
|
|
171
|
+
console.error('[CognitiveToolsServer v0.8.0] FATAL: Unhandled Promise Rejection:', reason);
|
|
172
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.0] Error during shutdown on unhandledRejection:', err)).finally(() => {
|
|
173
|
+
process.exit(1);
|
|
169
174
|
});
|
|
170
175
|
});
|
|
171
176
|
// Start the server
|
|
@@ -173,10 +178,10 @@ async function main() {
|
|
|
173
178
|
try {
|
|
174
179
|
const transport = new StdioServerTransport();
|
|
175
180
|
await server.connect(transport);
|
|
176
|
-
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.
|
|
181
|
+
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.0) MCP Server running on stdio');
|
|
177
182
|
}
|
|
178
183
|
catch (error) {
|
|
179
|
-
console.error('[CognitiveToolsServer v0.
|
|
184
|
+
console.error('[CognitiveToolsServer v0.8.0] Fatal error during startup:', error);
|
|
180
185
|
process.exit(1);
|
|
181
186
|
}
|
|
182
187
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Role: AI Pair Programmer (Navigator & Cognitive Engine v0.8.0)
|
|
2
|
+
|
|
3
|
+
You are my AI Pair Programmer. Your primary role is the **Navigator**: proactively thinking ahead, planning, analyzing requirements, anticipating issues, learning from interactions, and guiding the coding process with explicit, structured reasoning. I act as the 'Driver'.
|
|
4
|
+
|
|
5
|
+
Your **most critical function** is to utilize the provided `gikendaasowin-aabajichiganan-mcp` (Cognitive Tools MCP v0.8.0) suite to externalize and structure your thinking process. This ensures clarity, traceability, and robust collaboration, optimizing for cognitive enhancement by making reasoning explicit.
|
|
6
|
+
|
|
7
|
+
## Core Operating Principle: MANDATORY Structured Deliberation & Explicit Analysis
|
|
8
|
+
|
|
9
|
+
**The `think` tool is your central reasoning hub. You MUST use cognitive tools following a strict protocol centered around explicit assessment, structured thought generation, and mandatory analysis of that generated thought.**
|
|
10
|
+
|
|
11
|
+
**1. Mandatory Pre-Deliberation Assessment:**
|
|
12
|
+
* **Before executing ANY `think` or `quick_think` call**, you **MUST FIRST** call `assess_cuc_n_mode`.
|
|
13
|
+
* This assessment determines if the situation requires deep deliberation (`think`) or a brief check (`quick_think`) based on CUC-N criteria (Complexity, Uncertainty, Consequence, Novelty).
|
|
14
|
+
* **Input (`assessment_and_choice`):** MUST include the 4 required components: Situation Description, CUC-N Ratings (L/M/H), Recommended Initial Strategy, and Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').
|
|
15
|
+
|
|
16
|
+
**2. Mandatory `think` Usage & Content:**
|
|
17
|
+
* You **MUST** use the `think` tool (following the mandatory assessment above) in these situations:
|
|
18
|
+
* When `assess_cuc_n_mode` selects 'Selected Mode: think'.
|
|
19
|
+
* **IMMEDIATELY AFTER** receiving the returned text from other cognitive tools (`plan_and_solve`, `chain_of_thought`, `reflection`, `synthesize_prior_reasoning`, or the confirmation from `chain_of_draft`).
|
|
20
|
+
* Upon receiving a new complex request or clarification.
|
|
21
|
+
* Before generating significant code, explanations, or final responses.
|
|
22
|
+
* When encountering ambiguity, conflicts, or after `gauge_confidence` reports Medium/Low confidence.
|
|
23
|
+
* Before suggesting significant changes to architecture or existing code.
|
|
24
|
+
* **Internal Generation:** FIRST, *internally generate* your detailed, structured reasoning.
|
|
25
|
+
* **Tool Call:** THEN, call the `think` tool, passing your generated reasoning as the `thought` parameter.
|
|
26
|
+
* **`thought` Parameter Structure:** Your generated `thought` **MUST** use the following MANDATORY sections:
|
|
27
|
+
* `## Analysis:` (Of inputs, prior returned tool text - Plan, CoT, Critique, Summary, Confidence Justification, etc.)
|
|
28
|
+
* `## Plan:` (Concrete next steps, including specific tool usage planned and why)
|
|
29
|
+
* `## Verification:` (Check against requirements, constraints; state what's verified)
|
|
30
|
+
* `## Anticipated Challenges Analysis & Contingency:` (Address risks from plans/analysis; propose mitigations)
|
|
31
|
+
* `## Risk Assessment:` (Identify *new* risks introduced by the current plan/step)
|
|
32
|
+
* `## Lookahead:` (Brief implications for distant future steps)
|
|
33
|
+
* `## Self-Correction & Learning:` (Explicit corrections; note learnings)
|
|
34
|
+
* **Tool Result:** The `think` tool will return the exact `thought` text you sent, making it explicitly available in the context for your *next* mandatory assessment and subsequent `think` analysis.
|
|
35
|
+
|
|
36
|
+
**3. Exception: `quick_think` Usage:**
|
|
37
|
+
* You may ONLY use `quick_think` (following the mandatory assessment) if `assess_cuc_n_mode` selects 'Selected Mode: quick_think' due to **strictly Low CUC-N AND a genuinely simple task**. The tool returns a simple confirmation.
|
|
38
|
+
|
|
39
|
+
## Cognitive Toolkit Usage Protocol (v0.8.0 Tools):
|
|
40
|
+
|
|
41
|
+
**Crucial Change:** For most tools below, you now *generate the content internally* and then *pass that generated content to the tool call*. The tool returns the same content, making it explicit for your next `think` step's analysis.
|
|
42
|
+
|
|
43
|
+
1. **`assess_cuc_n_mode` (Mandatory Pre-Thought):** Call FIRST. Input (`assessment_and_choice`) is your assessment. Returns confirmation guiding next step.
|
|
44
|
+
2. **`think` (Core Tool):** Call as mandated above, after assessment. Input (`thought`) is your internally generated structured reasoning. Returns the same `thought` text.
|
|
45
|
+
3. **`quick_think` (Exception Tool):** Call only as allowed by assessment. Input (`brief_thought`) is concise. Returns simple confirmation.
|
|
46
|
+
4. **`synthesize_prior_reasoning` (Context Management):**
|
|
47
|
+
* **Internal Generation:** Generate structured summary text (incl. Key Decisions, Open Questions).
|
|
48
|
+
* **Tool Call:** Call tool with `generated_summary_text` (your summary) and `context_to_summarize_description`.
|
|
49
|
+
* **Tool Result:** Returns the `generated_summary_text`.
|
|
50
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the returned summary text.
|
|
51
|
+
5. **`gauge_confidence` (Meta-Cognitive Check):**
|
|
52
|
+
* **Internal Generation:** Assess confidence (H/M/L + Justification).
|
|
53
|
+
* **Tool Call:** Call tool with `assessment_and_confidence` (your assessment).
|
|
54
|
+
* **Tool Result:** Returns confirmation including confidence level.
|
|
55
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the confidence assessment text (from the tool result) and plan action (especially if Low/Medium).
|
|
56
|
+
6. **`plan_and_solve` (Strategic Planning):**
|
|
57
|
+
* **Internal Generation:** Generate structured plan text (incl. Anticipated Challenges/Risks, potential tool needs).
|
|
58
|
+
* **Tool Call:** Call tool with `generated_plan_text` (your plan) and `task_objective`.
|
|
59
|
+
* **Tool Result:** Returns the `generated_plan_text`.
|
|
60
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the returned plan text.
|
|
61
|
+
7. **`chain_of_thought` (Detailed Reasoning):**
|
|
62
|
+
* **Internal Generation:** Generate detailed CoT text (potentially noting needs for other tools).
|
|
63
|
+
* **Tool Call:** Call tool with `generated_cot_text` (your CoT) and `problem_statement`.
|
|
64
|
+
* **Tool Result:** Returns the `generated_cot_text`.
|
|
65
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the returned CoT text.
|
|
66
|
+
8. **`chain_of_draft` (Concise Exploration - Signal Only):**
|
|
67
|
+
* **Internal Generation:** Generate brief reasoning drafts.
|
|
68
|
+
* **Tool Call:** Call tool with `problem_statement` (as a signal).
|
|
69
|
+
* **Tool Result:** Returns confirmation message reminding you to analyze drafts.
|
|
70
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the drafts you generated internally.
|
|
71
|
+
9. **`reflection` (Self-Critique):**
|
|
72
|
+
* **Internal Generation:** Generate critique text on prior specific text.
|
|
73
|
+
* **Tool Call:** Call tool with `generated_critique_text` (your critique) and `input_reasoning_or_plan` (the text critiqued).
|
|
74
|
+
* **Tool Result:** Returns the `generated_critique_text`.
|
|
75
|
+
* **Post-Action:** **IMMEDIATELY call `assess_cuc_n_mode` then `think`** to analyze the returned critique text.
|
|
76
|
+
|
|
77
|
+
## Workflow & Interaction Protocol:
|
|
78
|
+
|
|
79
|
+
1. Receive my request/code/feedback.
|
|
80
|
+
2. **Mandatory `assess_cuc_n_mode`** -> Choose & execute `think` / `quick_think` (initial analysis/plan; call tool with generated `thought` if using `think`).
|
|
81
|
+
3. **Iterative Cognitive Loop (Repeat as needed):**
|
|
82
|
+
* Based on the analysis in the previous `think` step (operating on returned text), decide if another internal generation strategy is needed (Planning, CoT, Drafting, Reflection, Synthesis).
|
|
83
|
+
* If yes: Perform internal generation -> Call corresponding MCP tool (passing generated text as parameter, except for `chain_of_draft`).
|
|
84
|
+
* Receive tool result (which is the generated text, or confirmation).
|
|
85
|
+
* **Mandatory `assess_cuc_n_mode` -> Mandatory `think`** (Analyze the text returned by the previous tool; call `think` tool with this new analysis).
|
|
86
|
+
* Consider `gauge_confidence` -> **Mandatory `assess_cuc_n_mode` -> Mandatory `think`** (Analyze confidence result).
|
|
87
|
+
* If `think` identifies need for external tools: Plan -> Execute/Request external tool -> **Mandatory `assess_cuc_n_mode` -> Mandatory `think` / `quick_think`** (Analyze external tool result).
|
|
88
|
+
4. **Justified Deviation:** Flow is mandatory. Deviation requires explicit justification in the next `think` call's `thought` parameter.
|
|
89
|
+
5. **Final Output Preparation:**
|
|
90
|
+
* **Mandatory `assess_cuc_n_mode`**.
|
|
91
|
+
* **Mandatory `think` / `quick_think`** (Final verification; call tool with generated `thought` if using `think`).
|
|
92
|
+
* Generate code, explanation, or question for me.
|
|
93
|
+
|
|
94
|
+
## Output Expectations:
|
|
95
|
+
|
|
96
|
+
* Code: Clean, efficient, robust, well-commented.
|
|
97
|
+
* Explanations: Clear, concise, referencing cognitive steps.
|
|
98
|
+
* **Transparency:** Your reasoning process MUST be evident through your structured use of the MCP tools, especially the content passed to and returned by `think`. Show your work and meta-cognition.
|
|
99
|
+
|
|
100
|
+
**Adhere strictly and rigorously to this protocol. Prioritize mandatory assessment, structured internal generation, passing generated content to tools, and explicit analysis of returned content using `think`.**
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
// Create the MCP server - Version 0.8.0 reflects the change in tool signatures and return values
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "gikendaasowin-aabajichiganan-mcp",
|
|
9
|
+
version: "0.8.0", // Updated version
|
|
10
|
+
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.0): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.0+. Enforces mandatory structured deliberation via `think` after explicit assessment. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis, optimizing for cognitive enhancement."
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// --- Core Cognitive Deliberation Tools ---
|
|
14
|
+
|
|
15
|
+
server.tool(
|
|
16
|
+
"think",
|
|
17
|
+
// Main Description: Central hub, now returns the thought for explicit context.
|
|
18
|
+
"MANDATORY Cognitive Hub for Medium/High CUC-N situations. Analyzes inputs/prior steps, plans, verifies, assesses risks, self-corrects. Returns the detailed thought text for explicit grounding in the next step.",
|
|
19
|
+
{
|
|
20
|
+
// Parameter Description: Input IS the thought.
|
|
21
|
+
thought: z.string().describe("Your **detailed** internal monologue following the MANDATORY structure: ## Analysis, ## Plan, ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
22
|
+
},
|
|
23
|
+
async ({ thought }) => {
|
|
24
|
+
if (!thought || typeof thought !== 'string' || thought.trim().length === 0) { throw new Error('Invalid thought: Must be non-empty, structured reasoning.'); }
|
|
25
|
+
console.error(`[CognitiveToolsServer v0.8.0] Think Tool Received: ${thought.substring(0, 150)}...`);
|
|
26
|
+
// Returns the same thought text received, making it explicit in context.
|
|
27
|
+
return { content: [{ type: "text" as const, text: thought }] };
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
server.tool(
|
|
32
|
+
"quick_think",
|
|
33
|
+
// Main Description: Unchanged - simple confirmation is sufficient here.
|
|
34
|
+
"Cognitive Checkpoint ONLY for situations explicitly assessed as strictly Low CUC-N AND simple task nature. Use sparingly. Logs brief thought.",
|
|
35
|
+
{
|
|
36
|
+
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment.")
|
|
37
|
+
},
|
|
38
|
+
async ({ brief_thought }) => {
|
|
39
|
+
if (!brief_thought || typeof brief_thought !== 'string' || brief_thought.trim().length === 0) { throw new Error('Invalid brief_thought: Must be non-empty.'); }
|
|
40
|
+
console.error(`[CognitiveToolsServer v0.8.0] QuickThink Tool Logged: ${brief_thought.substring(0, 100)}...`);
|
|
41
|
+
// Simple confirmation remains appropriate for quick_think.
|
|
42
|
+
return { content: [{ type: "text" as const, text: `Quick Thought logged successfully.` }] };
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// --- Mandatory Meta-Cognitive Tools (Responses remain concise confirmations) ---
|
|
47
|
+
|
|
48
|
+
server.tool(
|
|
49
|
+
"assess_complexity_and_select_thought_mode",
|
|
50
|
+
// Main Description: Unchanged.
|
|
51
|
+
"**Mandatory Pre-Deliberation Assessment.** Must be called BEFORE every `think` or `quick_think`. Evaluates CUC-N, recommends strategy, commits to next thought mode.",
|
|
52
|
+
{
|
|
53
|
+
// Parameter Description: Unchanged.
|
|
54
|
+
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation Description, 2) CUC-N Ratings (L/M/H), 3) Recommended Initial Strategy, 4) Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').")
|
|
55
|
+
},
|
|
56
|
+
async ({ assessment_and_choice }) => {
|
|
57
|
+
const requiredPhrases = ["Complexity", "Uncertainty", "Consequence", "Novelty", "Recommended Initial Strategy", "Selected Mode:"];
|
|
58
|
+
const hasRequiredPhrases = requiredPhrases.every(phrase => assessment_and_choice.includes(phrase));
|
|
59
|
+
const hasModeSelection = assessment_and_choice.includes("Selected Mode: think") || assessment_and_choice.includes("Selected Mode: quick_think");
|
|
60
|
+
if (!assessment_and_choice || typeof assessment_and_choice !== 'string' || !hasRequiredPhrases || !hasModeSelection) { throw new Error('Invalid assessment: String must include CUC-N ratings, Recommended Initial Strategy, and explicit Selected Mode ("think" or "quick_think").'); }
|
|
61
|
+
console.error(`[CognitiveToolsServer v0.8.0] AssessComplexity Tool Signaled: ${assessment_and_choice.substring(0, 150)}...`);
|
|
62
|
+
const mode = assessment_and_choice.includes("Selected Mode: think") ? "think" : "quick_think";
|
|
63
|
+
// Confirmation guides the next step.
|
|
64
|
+
return { content: [{ type: "text" as const, text: `Cognitive Assessment Completed. Proceeding with selected mode: ${mode}. Full Assessment: ${assessment_and_choice}` }] };
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
server.tool(
|
|
69
|
+
"gauge_confidence",
|
|
70
|
+
// Main Description: Unchanged.
|
|
71
|
+
"Meta-Cognitive Checkpoint. Guides internal stating of **confidence (High/Medium/Low) and justification**. Output MUST be analyzed in the mandatory `think` step immediately after; Low/Medium confidence requires specific action planning.",
|
|
72
|
+
{
|
|
73
|
+
// Parameter Description: Unchanged.
|
|
74
|
+
assessment_and_confidence: z.string().describe("Input item being assessed. *Internally determine and state*: 1) Confidence Level (H/M/L). 2) Justification. Call this tool *after* making the assessment.")
|
|
75
|
+
},
|
|
76
|
+
async ({ assessment_and_confidence }) => {
|
|
77
|
+
const confidenceRegex = /Confidence Level: (High|Medium|Low)/i;
|
|
78
|
+
if (!assessment_and_confidence || typeof assessment_and_confidence !== 'string' || !confidenceRegex.test(assessment_and_confidence)) { throw new Error('Invalid confidence assessment: String must include "Confidence Level: High/Medium/Low" and justification.'); }
|
|
79
|
+
const match = assessment_and_confidence.match(confidenceRegex);
|
|
80
|
+
const level = match ? match[1] : "Unknown";
|
|
81
|
+
console.error(`[CognitiveToolsServer v0.8.0] GaugeConfidence Tool Signaled: Level ${level}`);
|
|
82
|
+
// Confirmation includes level, prepares for mandatory analysis.
|
|
83
|
+
return { content: [{ type: "text" as const, text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory post-assessment 'think' analysis (action required if Low/Medium).` }] };
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
// --- Supporting Cognitive Strategy Tools (Now Accept & Return Generated Text) ---
|
|
89
|
+
|
|
90
|
+
server.tool(
|
|
91
|
+
"plan_and_solve",
|
|
92
|
+
// Main Description: Now returns the plan text itself.
|
|
93
|
+
"Guides internal generation of **structured plan text** (incl. Risks/Challenges, potential tool needs). Call this tool *with* the generated plan text. Returns the plan text for mandatory `think` analysis.",
|
|
94
|
+
{
|
|
95
|
+
// NEW Parameter: Accepts the generated plan.
|
|
96
|
+
generated_plan_text: z.string().describe("The **full, structured plan text** you generated internally, including Anticipated Challenges/Risks and potential other tool needs."),
|
|
97
|
+
task_objective: z.string().describe("The original high-level task objective this plan addresses.") // Keep original objective for context logging.
|
|
98
|
+
},
|
|
99
|
+
async ({ generated_plan_text, task_objective }) => {
|
|
100
|
+
if (!generated_plan_text || typeof generated_plan_text !== 'string' || generated_plan_text.trim().length === 0) { throw new Error('Invalid generated_plan_text: Must be non-empty.'); }
|
|
101
|
+
if (!task_objective || typeof task_objective !== 'string' || task_objective.trim().length === 0) { throw new Error('Invalid task_objective.'); }
|
|
102
|
+
console.error(`[CognitiveToolsServer v0.8.0] PlanAndSolve Tool Received Plan for Objective: ${task_objective.substring(0, 100)}...`);
|
|
103
|
+
// Returns the actual plan text received.
|
|
104
|
+
return { content: [{ type: "text" as const, text: generated_plan_text }] };
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
server.tool(
|
|
109
|
+
"chain_of_thought",
|
|
110
|
+
// Main Description: Now returns the CoT text itself.
|
|
111
|
+
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. Call this tool *with* the generated CoT text. Returns the CoT text for mandatory `think` analysis.",
|
|
112
|
+
{
|
|
113
|
+
// NEW Parameter: Accepts the generated CoT.
|
|
114
|
+
generated_cot_text: z.string().describe("The **full, step-by-step Chain of Thought text** you generated internally, potentially noting needs for other tools."),
|
|
115
|
+
problem_statement: z.string().describe("The original problem statement this CoT addresses.") // Keep original problem statement for context logging.
|
|
116
|
+
},
|
|
117
|
+
async ({ generated_cot_text, problem_statement }) => {
|
|
118
|
+
if (!generated_cot_text || typeof generated_cot_text !== 'string' || generated_cot_text.trim().length === 0) { throw new Error('Invalid generated_cot_text: Must be non-empty.'); }
|
|
119
|
+
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem_statement.'); }
|
|
120
|
+
console.error(`[CognitiveToolsServer v0.8.0] ChainOfThought Tool Received CoT for Problem: ${problem_statement.substring(0, 100)}...`);
|
|
121
|
+
// Returns the actual CoT text received.
|
|
122
|
+
return { content: [{ type: "text" as const, text: generated_cot_text }] };
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
server.tool(
|
|
127
|
+
"chain_of_draft",
|
|
128
|
+
// Main Description: Keeping as signal due to complexity of multiple drafts. Response reinforces next step.
|
|
129
|
+
"Guides internal generation of **concise, iterative reasoning draft texts**. Call this tool *after* generating drafts internally. Response confirms generation; drafts MUST be analyzed via mandatory `think`.",
|
|
130
|
+
{
|
|
131
|
+
// Parameter: Still just the problem statement. LLM handles drafts internally.
|
|
132
|
+
problem_statement: z.string().describe("Input problem for exploration. *You* (LLM) must now *internally generate brief, iterative draft texts*. Call this tool *after* generation to signal readiness for analysis.")
|
|
133
|
+
},
|
|
134
|
+
async ({ problem_statement }) => {
|
|
135
|
+
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem statement.'); }
|
|
136
|
+
console.error(`[CognitiveToolsServer v0.8.0] ChainOfDraft Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
137
|
+
// Returns confirmation, strongly reminding LLM of the mandatory next step.
|
|
138
|
+
return { content: [{ type: "text" as const, text: `Reasoning drafts generated internally for problem: ${problem_statement}. MANDATORY: Analyze these drafts now in your next post-assessment 'think' step.` }] };
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
server.tool(
|
|
143
|
+
"reflection",
|
|
144
|
+
// Main Description: Now returns the critique text itself.
|
|
145
|
+
"Guides internal critical self-evaluation on prior text. Call this tool *with* the **generated critique text**. Returns the critique text for mandatory `think` analysis.",
|
|
146
|
+
{
|
|
147
|
+
// NEW Parameter: Accepts the generated critique.
|
|
148
|
+
generated_critique_text: z.string().describe("The **full critique text** you generated internally, identifying flaws and suggesting improvements."),
|
|
149
|
+
input_reasoning_or_plan: z.string().describe("The original text that was critiqued.") // Keep original text for context logging.
|
|
150
|
+
},
|
|
151
|
+
async ({ generated_critique_text, input_reasoning_or_plan }) => {
|
|
152
|
+
if (!generated_critique_text || typeof generated_critique_text !== 'string' || generated_critique_text.trim().length === 0) { throw new Error('Invalid generated_critique_text: Must be non-empty.'); }
|
|
153
|
+
if (!input_reasoning_or_plan || typeof input_reasoning_or_plan !== 'string' || input_reasoning_or_plan.trim().length === 0) { throw new Error('Invalid input_reasoning_or_plan.'); }
|
|
154
|
+
console.error(`[CognitiveToolsServer v0.8.0] Reflection Tool Received Critique for: ${input_reasoning_or_plan.substring(0, 100)}...`);
|
|
155
|
+
// Returns the actual critique text received.
|
|
156
|
+
return { content: [{ type: "text" as const, text: generated_critique_text }] };
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
server.tool(
|
|
161
|
+
"synthesize_prior_reasoning",
|
|
162
|
+
// Main Description: Now returns the summary text itself.
|
|
163
|
+
"Context Management Tool. Guides internal generation of a **structured summary text** (incl. Key Decisions, Open Questions). Call this tool *with* the generated summary text. Returns the summary for mandatory `think` analysis.",
|
|
164
|
+
{
|
|
165
|
+
// NEW Parameter: Accepts the generated summary.
|
|
166
|
+
generated_summary_text: z.string().describe("The **full, structured summary text** you generated internally."),
|
|
167
|
+
context_to_summarize_description: z.string().describe("Description of the reasoning span that was summarized.") // Keep description for context logging.
|
|
168
|
+
},
|
|
169
|
+
async ({ generated_summary_text, context_to_summarize_description }) => {
|
|
170
|
+
if (!generated_summary_text || typeof generated_summary_text !== 'string' || generated_summary_text.trim().length === 0) { throw new Error('Invalid generated_summary_text: Must be non-empty.'); }
|
|
171
|
+
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) { throw new Error('Invalid context_to_summarize_description.'); }
|
|
172
|
+
console.error(`[CognitiveToolsServer v0.8.0] SynthesizeReasoning Tool Received Summary for: ${context_to_summarize_description}...`);
|
|
173
|
+
// Returns the actual summary text received.
|
|
174
|
+
return { content: [{ type: "text" as const, text: generated_summary_text }] };
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
// --- Server Lifecycle and Error Handling (Unchanged) ---
|
|
180
|
+
|
|
181
|
+
process.on('SIGINT', async () => {
|
|
182
|
+
console.error('\n[CognitiveToolsServer v0.8.0] Received SIGINT, shutting down gracefully.');
|
|
183
|
+
await server.close();
|
|
184
|
+
process.exit(0);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
process.on('SIGTERM', async () => {
|
|
188
|
+
console.error('\n[CognitiveToolsServer v0.8.0] Received SIGTERM, shutting down gracefully.');
|
|
189
|
+
await server.close();
|
|
190
|
+
process.exit(0);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
process.on('uncaughtException', (error) => {
|
|
194
|
+
console.error('[CognitiveToolsServer v0.8.0] FATAL: Uncaught Exception:', error);
|
|
195
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.0] Error during shutdown on uncaughtException:', err)).finally(() => {
|
|
196
|
+
process.exit(1);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
201
|
+
console.error('[CognitiveToolsServer v0.8.0] FATAL: Unhandled Promise Rejection:', reason);
|
|
202
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.0] Error during shutdown on unhandledRejection:', err)).finally(() => {
|
|
203
|
+
process.exit(1);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// Start the server
|
|
208
|
+
async function main() {
|
|
209
|
+
try {
|
|
210
|
+
const transport = new StdioServerTransport();
|
|
211
|
+
await server.connect(transport);
|
|
212
|
+
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.0) MCP Server running on stdio');
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
console.error('[CognitiveToolsServer v0.8.0] Fatal error during startup:', error);
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Execute the main function to start the server
|
|
221
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cognitive Tools MCP v0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Cognitive Tools MCP v0.8.1: SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.0+. 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",
|
|
7
7
|
"bin": {
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
// Create the MCP server
|
|
7
|
-
const server = new McpServer({
|
|
8
|
-
name: "gikendaasowin-aabajichiganan-mcp",
|
|
9
|
-
// Version aligned with System Prompt v0.7.2
|
|
10
|
-
version: "0.7.2",
|
|
11
|
-
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.7.2): SOTA internal reasoning suite aligned with AI Pair Programmer Prompt v0.7.2. Enforces mandatory structured deliberation via `think` after explicit assessment (`assess_complexity...`). Includes meta-cognition (`gauge_confidence`), context synthesis, proactive planning, CoT, reflection, and tool awareness."
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// --- Core Cognitive Deliberation Tools ---
|
|
15
|
-
|
|
16
|
-
server.tool(
|
|
17
|
-
"think",
|
|
18
|
-
// Main Description: Matches v0.7.2 prompt's emphasis on the central hub role.
|
|
19
|
-
"MANDATORY Cognitive Hub for **Medium/High CUC-N** situations or inherently complex tasks (analysis, planning, refinement). Use for deep analysis, planning, verification, risk assessment, self-correction, and integrating outputs from other tools/actions. Logs detailed reasoning.",
|
|
20
|
-
{
|
|
21
|
-
// Parameter Description: Matches the mandatory structured sections required by prompt v0.7.2.
|
|
22
|
-
thought: z.string().describe("Your **detailed** internal monologue. MUST explicitly analyze prior steps & generated text (CoT, Plan, Critique, Summary, Confidence Justification, etc.). Structure MANDATORY: ## Analysis, ## Plan, ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
23
|
-
},
|
|
24
|
-
async ({ thought }) => {
|
|
25
|
-
if (!thought || typeof thought !== 'string' || thought.trim().length === 0) { throw new Error('Invalid thought: Must be non-empty, structured reasoning.'); }
|
|
26
|
-
console.error(`[CognitiveToolsServer v0.7.2] Think Tool Logged: ${thought.substring(0, 100)}...`);
|
|
27
|
-
return { content: [{ type: "text" as const, text: `Deep Thought (structured analysis/plan/etc.) logged successfully.` }] };
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
server.tool(
|
|
32
|
-
"quick_think",
|
|
33
|
-
// Main Description: Matches v0.7.2 prompt's strict conditions.
|
|
34
|
-
"Cognitive Checkpoint ONLY for situations explicitly assessed as **strictly Low CUC-N AND simple task nature** (e.g., confirmation, acknowledgement). Use sparingly. Logs brief thought.",
|
|
35
|
-
{
|
|
36
|
-
// Parameter Description: Simple input for brief thoughts.
|
|
37
|
-
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment (e.g., 'Acknowledged.', 'Proceeding as planned.', 'External tool call successful.').")
|
|
38
|
-
},
|
|
39
|
-
async ({ brief_thought }) => {
|
|
40
|
-
if (!brief_thought || typeof brief_thought !== 'string' || brief_thought.trim().length === 0) { throw new Error('Invalid brief_thought: Must be non-empty.'); }
|
|
41
|
-
console.error(`[CognitiveToolsServer v0.7.2] QuickThink Tool Logged: ${brief_thought.substring(0, 100)}...`);
|
|
42
|
-
return { content: [{ type: "text" as const, text: `Quick Thought logged successfully.` }] };
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
// --- Mandatory Meta-Cognitive & Context Management Tools ---
|
|
47
|
-
|
|
48
|
-
server.tool(
|
|
49
|
-
"assess_complexity_and_select_thought_mode",
|
|
50
|
-
// Main Description: Matches v0.7.2 prompt's mandatory first step.
|
|
51
|
-
"**Mandatory Pre-Deliberation Assessment.** Must be called BEFORE every `think` or `quick_think`. Evaluates CUC-N, recommends strategy, commits to next thought mode.",
|
|
52
|
-
{
|
|
53
|
-
// Parameter Description: Matches the 4 required components from prompt v0.7.2.
|
|
54
|
-
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation/Next Step Description. 2) CUC-N Ratings: Complexity(L/M/H), Uncertainty(L/M/H), Consequence(L/M/H), Novelty(L/M/H). 3) Recommended Initial Strategy (e.g., 'Start `think` analysis'). 4) Explicit Mode Selection: 'Selected Mode: think' or 'Selected Mode: quick_think'.")
|
|
55
|
-
},
|
|
56
|
-
async ({ assessment_and_choice }) => {
|
|
57
|
-
const requiredPhrases = ["Complexity", "Uncertainty", "Consequence", "Novelty", "Recommended Initial Strategy", "Selected Mode:"];
|
|
58
|
-
const hasRequiredPhrases = requiredPhrases.every(phrase => assessment_and_choice.includes(phrase));
|
|
59
|
-
const hasModeSelection = assessment_and_choice.includes("Selected Mode: think") || assessment_and_choice.includes("Selected Mode: quick_think");
|
|
60
|
-
if (!assessment_and_choice || typeof assessment_and_choice !== 'string' || !hasRequiredPhrases || !hasModeSelection) { throw new Error('Invalid assessment: String must include CUC-N ratings, Recommended Initial Strategy, and explicit Selected Mode ("think" or "quick_think").'); }
|
|
61
|
-
console.error(`[CognitiveToolsServer v0.7.2] AssessComplexity Tool Signaled: ${assessment_and_choice.substring(0, 150)}...`);
|
|
62
|
-
const mode = assessment_and_choice.includes("Selected Mode: think") ? "think" : "quick_think";
|
|
63
|
-
// Output confirms assessment passed validation and guides the immediate next step (think/quick_think call).
|
|
64
|
-
return { content: [{ type: "text" as const, text: `Cognitive Assessment Completed. Proceeding with selected mode: ${mode}. Full Assessment: ${assessment_and_choice}` }] };
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
server.tool(
|
|
69
|
-
"synthesize_prior_reasoning",
|
|
70
|
-
// Main Description: Aligned with prompt's goal of structured summary to feed into mandatory 'think'.
|
|
71
|
-
"Context Management Tool. Guides internal generation of a **structured summary text** (focusing on **`Key Decisions Made`** and **`Open Questions/Uncertainties`**) for long reasoning chains. Output text MUST be analyzed via mandatory `think` immediately after.",
|
|
72
|
-
{
|
|
73
|
-
// Parameter Description: Reminds LLM of the required internal summary structure.
|
|
74
|
-
context_to_summarize_description: z.string().describe("Describe the reasoning span being summarized. *You* (LLM) must now *internally generate the structured summary text* before calling. This signals the summary is ready for the mandatory post-assessment `think` analysis.")
|
|
75
|
-
},
|
|
76
|
-
async ({ context_to_summarize_description }) => {
|
|
77
|
-
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) { throw new Error('Invalid context description: Must be non-empty.'); }
|
|
78
|
-
console.error(`[CognitiveToolsServer v0.7.2] SynthesizeReasoning Tool Signaled for: ${context_to_summarize_description}...`);
|
|
79
|
-
// Output implies structured summary is ready for analysis via the mandatory next assessment/think steps.
|
|
80
|
-
return { content: [{ type: "text" as const, text: `Structured synthesis internally generated for context: '${context_to_summarize_description}'. Ready for mandatory post-assessment 'think' analysis.` }] };
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
server.tool(
|
|
85
|
-
"gauge_confidence",
|
|
86
|
-
// Main Description: Aligned with prompt's active confidence management feeding into mandatory 'think'.
|
|
87
|
-
"Meta-Cognitive Checkpoint. Guides internal stating of **confidence (High/Medium/Low) and justification**. Output MUST be analyzed in the mandatory `think` step immediately after; Low/Medium confidence requires specific action planning in that `think` step.",
|
|
88
|
-
{
|
|
89
|
-
// Parameter Description: Matches prompt requirements.
|
|
90
|
-
assessment_and_confidence: z.string().describe("Input item being assessed. *Internally determine and state*: 1) Confidence Level (High/Medium/Low). 2) Justification. Call this tool *after* making the assessment.")
|
|
91
|
-
},
|
|
92
|
-
async ({ assessment_and_confidence }) => {
|
|
93
|
-
const confidenceRegex = /Confidence Level: (High|Medium|Low)/i;
|
|
94
|
-
if (!assessment_and_confidence || typeof assessment_and_confidence !== 'string' || !confidenceRegex.test(assessment_and_confidence)) { throw new Error('Invalid confidence assessment: String must include "Confidence Level: High/Medium/Low" and justification.'); }
|
|
95
|
-
const match = assessment_and_confidence.match(confidenceRegex);
|
|
96
|
-
const level = match ? match[1] : "Unknown";
|
|
97
|
-
console.error(`[CognitiveToolsServer v0.7.2] GaugeConfidence Tool Signaled: Level ${level}`);
|
|
98
|
-
// Output confirms level and prepares for mandatory analysis via assessment/think.
|
|
99
|
-
return { content: [{ type: "text" as const, text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory post-assessment 'think' analysis (action required if Low/Medium).` }] };
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
// --- Supporting Cognitive Strategy Tools (Trigger Mandatory 'Think' Analysis After) ---
|
|
104
|
-
|
|
105
|
-
server.tool(
|
|
106
|
-
"plan_and_solve",
|
|
107
|
-
// Main Description: Aligned with proactive planning including risks and tool awareness.
|
|
108
|
-
"Guides internal generation of **structured plan text** (incl. **`Anticipated Challenges/Risks`** and potential **other tool needs**). Generated text MUST be analyzed via mandatory `think` immediately after.",
|
|
109
|
-
{
|
|
110
|
-
// Parameter Description: Reminds LLM of required internal generation content.
|
|
111
|
-
task_objective: z.string().describe("Input the objective. *You* (LLM) must now *internally generate the structured plan text (incl. Risks/Challenges, potential tool needs)* before calling. Signals plan text is ready for mandatory post-assessment `think` analysis.")
|
|
112
|
-
},
|
|
113
|
-
async ({ task_objective }) => {
|
|
114
|
-
if (!task_objective || typeof task_objective !== 'string' || task_objective.trim().length === 0) { throw new Error('Invalid task objective.'); }
|
|
115
|
-
console.error(`[CognitiveToolsServer v0.7.2] PlanAndSolve Tool Signaled for: ${task_objective.substring(0, 100)}...`);
|
|
116
|
-
// Output implies plan text *with risks and potential tool needs* is ready for mandatory analysis via assessment/think.
|
|
117
|
-
return { content: [{ type: "text" as const, text: `Structured plan (incl. Risks/Challenges, potential tool needs) internally generated for objective: ${task_objective}. Ready for mandatory post-assessment 'think' analysis.` }] };
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
server.tool(
|
|
122
|
-
"chain_of_thought",
|
|
123
|
-
// Main Description: Refined to explicitly mention potential for other tools within the reasoning.
|
|
124
|
-
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. CoT steps might identify needs for **other tools**. Generated CoT text MUST be analyzed via mandatory `think` immediately after.",
|
|
125
|
-
{
|
|
126
|
-
// Parameter Description: Explicitly guides internal generation to consider tool needs.
|
|
127
|
-
problem_statement: z.string().describe("Input the specific problem requiring detailed CoT. *You* (LLM) must now *internally generate the full CoT text*, explicitly noting steps suggesting needs for other tools. Call this tool *after* generating the text.")
|
|
128
|
-
},
|
|
129
|
-
async ({ problem_statement }) => {
|
|
130
|
-
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem statement.'); }
|
|
131
|
-
console.error(`[CognitiveToolsServer v0.7.2] ChainOfThought Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
132
|
-
// Output implies CoT text *potentially identifying tool needs* is ready for mandatory analysis via assessment/think.
|
|
133
|
-
return { content: [{ type: "text" as const, text: `Detailed CoT (potentially identifying needs for other tools) internally generated for problem: ${problem_statement}. Ready for mandatory post-assessment 'think' analysis.` }] };
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
server.tool(
|
|
138
|
-
"chain_of_draft",
|
|
139
|
-
// Main Description: Positions for efficient exploration, results analyzed by mandatory 'think'.
|
|
140
|
-
"Guides internal generation of **concise, iterative reasoning draft texts** ('thought-sketches') for exploring options. Generated drafts MUST be analyzed comparatively via mandatory `think` immediately after.",
|
|
141
|
-
{
|
|
142
|
-
// Parameter Description: Instructs LLM on internal draft generation.
|
|
143
|
-
problem_statement: z.string().describe("Input problem for exploration. *You* (LLM) must now *internally generate brief, iterative draft texts* before calling. Signals drafts are ready for mandatory post-assessment `think` analysis.")
|
|
144
|
-
},
|
|
145
|
-
async ({ problem_statement }) => {
|
|
146
|
-
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem statement.'); }
|
|
147
|
-
console.error(`[CognitiveToolsServer v0.7.2] ChainOfDraft Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
148
|
-
// Output implies draft texts are ready for mandatory comparative analysis via assessment/think.
|
|
149
|
-
return { content: [{ type: "text" as const, text: `Reasoning drafts internally generated for problem: ${problem_statement}. Ready for mandatory post-assessment 'think' analysis.` }] };
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
server.tool(
|
|
154
|
-
"reflection",
|
|
155
|
-
// Main Description: Explicitly mentions taking prior text as input for critique, results analyzed by mandatory 'think'.
|
|
156
|
-
"Guides internal critical self-evaluation on **previously generated text** (reasoning, plans, code concepts). Generated critique text MUST be analyzed via mandatory `think` immediately after.",
|
|
157
|
-
{
|
|
158
|
-
// Parameter Description: Input is the specific text to be critiqued internally.
|
|
159
|
-
input_reasoning_or_plan: z.string().describe("Input the **exact text** to be critiqued. *You* (LLM) must now *internally generate a critique* identifying flaws/improvements. Call this tool *after* generating the critique.")
|
|
160
|
-
},
|
|
161
|
-
async ({ input_reasoning_or_plan }) => {
|
|
162
|
-
if (!input_reasoning_or_plan || typeof input_reasoning_or_plan !== 'string' || input_reasoning_or_plan.trim().length === 0) { throw new Error('Invalid input reasoning/plan.'); }
|
|
163
|
-
console.error(`[CognitiveToolsServer v0.7.2] Reflection Tool Signaled for analysis.`);
|
|
164
|
-
// Output implies critique text is ready for mandatory analysis via assessment/think.
|
|
165
|
-
return { content: [{ type: "text" as const, text: `Reflection critique internally generated for input text: '${input_reasoning_or_plan.substring(0, 100)}...'. Ready for mandatory post-assessment 'think' analysis.` }] };
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
// --- Server Lifecycle and Error Handling ---
|
|
170
|
-
|
|
171
|
-
process.on('SIGINT', async () => {
|
|
172
|
-
console.error('\n[CognitiveToolsServer v0.7.2] Received SIGINT, shutting down gracefully.');
|
|
173
|
-
await server.close();
|
|
174
|
-
process.exit(0);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
process.on('SIGTERM', async () => {
|
|
178
|
-
console.error('\n[CognitiveToolsServer v0.7.2] Received SIGTERM, shutting down gracefully.');
|
|
179
|
-
await server.close();
|
|
180
|
-
process.exit(0);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
process.on('uncaughtException', (error) => {
|
|
184
|
-
console.error('[CognitiveToolsServer v0.7.2] FATAL: Uncaught Exception:', error);
|
|
185
|
-
server.close().catch(err => console.error('[CognitiveToolsServer v0.7.2] Error during shutdown on uncaughtException:', err)).finally(() => {
|
|
186
|
-
process.exit(1); // Exit on fatal error
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
191
|
-
console.error('[CognitiveToolsServer v0.7.2] FATAL: Unhandled Promise Rejection:', reason);
|
|
192
|
-
server.close().catch(err => console.error('[CognitiveToolsServer v0.7.2] Error during shutdown on unhandledRejection:', err)).finally(() => {
|
|
193
|
-
process.exit(1); // Exit on fatal error
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// Start the server
|
|
198
|
-
async function main() {
|
|
199
|
-
try {
|
|
200
|
-
const transport = new StdioServerTransport();
|
|
201
|
-
await server.connect(transport);
|
|
202
|
-
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.7.2) MCP Server running on stdio');
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.error('[CognitiveToolsServer v0.7.2] Fatal error during startup:', error);
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Execute the main function to start the server
|
|
211
|
-
main();
|
|
File without changes
|