#
tokens: 44455/50000 17/128 files (page 3/13)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 3 of 13. Use http://codebase.md/tejpalvirk/contextmanager?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .gitattributes
├── .gitignore
├── build-all-domains.sh
├── developer
│   ├── .gitattributes
│   ├── developer_advancedcontext.txt
│   ├── developer_buildcontext.txt
│   ├── developer_deletecontext.txt
│   ├── developer_endsession_examples.txt
│   ├── developer_endsession.txt
│   ├── developer_loadcontext.txt
│   ├── developer_startsession.txt
│   ├── Dockerfile
│   ├── index.d.ts
│   ├── index.js
│   ├── index.ts
│   ├── package.json
│   ├── README.md
│   └── tsconfig.json
├── dist
│   ├── developer
│   │   ├── index.d.ts
│   │   └── index.js
│   ├── main
│   │   ├── descriptions
│   │   │   ├── common_advancedcontext.txt
│   │   │   ├── common_buildcontext.txt
│   │   │   ├── common_deletecontext.txt
│   │   │   ├── common_endsession.txt
│   │   │   ├── common_loadcontext.txt
│   │   │   ├── common_startsession.txt
│   │   │   ├── developer_advancedcontext.txt
│   │   │   ├── developer_buildcontext.txt
│   │   │   ├── developer_deletecontext.txt
│   │   │   ├── developer_endsession_examples.txt
│   │   │   ├── developer_endsession.txt
│   │   │   ├── developer_loadcontext.txt
│   │   │   ├── developer_startsession.txt
│   │   │   ├── project_advancedcontext.txt
│   │   │   ├── project_buildcontext.txt
│   │   │   ├── project_deletecontext.txt
│   │   │   ├── project_endsession_examples.txt
│   │   │   ├── project_endsession.txt
│   │   │   ├── project_loadcontext.txt
│   │   │   ├── project_startsession.txt
│   │   │   ├── qualitativeresearch_advancedcontext.txt
│   │   │   ├── qualitativeresearch_buildcontext.txt
│   │   │   ├── qualitativeresearch_deletecontext.txt
│   │   │   ├── qualitativeresearch_endsession_examples.txt
│   │   │   ├── qualitativeresearch_endsession.txt
│   │   │   ├── qualitativeresearch_loadcontext.txt
│   │   │   ├── qualitativeresearch_startsession.txt
│   │   │   ├── quantitativeresearch_advancedcontext.txt
│   │   │   ├── quantitativeresearch_buildcontext.txt
│   │   │   ├── quantitativeresearch_deletecontext.txt
│   │   │   ├── quantitativeresearch_endsession_examples.txt
│   │   │   ├── quantitativeresearch_endsession.txt
│   │   │   ├── quantitativeresearch_loadcontext.txt
│   │   │   ├── quantitativeresearch_startsession.txt
│   │   │   ├── student_advancedcontext.txt
│   │   │   ├── student_buildcontext.txt
│   │   │   ├── student_deletecontext.txt
│   │   │   ├── student_endsession_examples.txt
│   │   │   ├── student_endsession.txt
│   │   │   ├── student_loadcontext.txt
│   │   │   └── student_startsession.txt
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── mcp.d.ts
│   │   └── mcp.js
│   ├── project
│   │   ├── index.d.ts
│   │   └── index.js
│   ├── qualitativeresearch
│   │   ├── index.d.ts
│   │   └── index.js
│   ├── quantitativeresearch
│   │   ├── index.d.ts
│   │   └── index.js
│   └── student
│       ├── index.d.ts
│       └── index.js
├── main
│   ├── descriptions
│   │   ├── common_advancedcontext.txt
│   │   ├── common_buildcontext.txt
│   │   ├── common_deletecontext.txt
│   │   ├── common_endsession.txt
│   │   ├── common_loadcontext.txt
│   │   ├── common_startsession.txt
│   │   ├── developer_advancedcontext.txt
│   │   ├── developer_buildcontext.txt
│   │   ├── developer_deletecontext.txt
│   │   ├── developer_endsession_examples.txt
│   │   ├── developer_endsession.txt
│   │   ├── developer_loadcontext.txt
│   │   ├── developer_startsession.txt
│   │   ├── project_advancedcontext.txt
│   │   ├── project_buildcontext.txt
│   │   ├── project_deletecontext.txt
│   │   ├── project_endsession_examples.txt
│   │   ├── project_endsession.txt
│   │   ├── project_loadcontext.txt
│   │   ├── project_startsession.txt
│   │   ├── qualitativeresearch_advancedcontext.txt
│   │   ├── qualitativeresearch_buildcontext.txt
│   │   ├── qualitativeresearch_deletecontext.txt
│   │   ├── qualitativeresearch_endsession_examples.txt
│   │   ├── qualitativeresearch_endsession.txt
│   │   ├── qualitativeresearch_loadcontext.txt
│   │   ├── qualitativeresearch_startsession.txt
│   │   ├── quantitativeresearch_advancedcontext.txt
│   │   ├── quantitativeresearch_buildcontext.txt
│   │   ├── quantitativeresearch_deletecontext.txt
│   │   ├── quantitativeresearch_endsession_examples.txt
│   │   ├── quantitativeresearch_endsession.txt
│   │   ├── quantitativeresearch_loadcontext.txt
│   │   ├── quantitativeresearch_startsession.txt
│   │   ├── student_advancedcontext.txt
│   │   ├── student_buildcontext.txt
│   │   ├── student_deletecontext.txt
│   │   ├── student_endsession_examples.txt
│   │   ├── student_endsession.txt
│   │   ├── student_loadcontext.txt
│   │   └── student_startsession.txt
│   ├── index.js
│   ├── index.ts
│   ├── mcp.ts
│   ├── package.json
│   ├── README.md
│   └── tsconfig.json
├── package-lock.json
├── package.json
├── project
│   ├── .gitattributes
│   ├── Dockerfile
│   ├── index.d.ts
│   ├── index.js
│   ├── index.ts
│   ├── package.json
│   ├── project_advancedcontext.txt
│   ├── project_buildcontext.txt
│   ├── project_deletecontext.txt
│   ├── project_endsession_examples.txt
│   ├── project_endsession.txt
│   ├── project_loadcontext.txt
│   ├── project_startsession.txt
│   ├── README.md
│   └── tsconfig.json
├── qualitativeresearch
│   ├── .gitattributes
│   ├── Dockerfile
│   ├── index.d.ts
│   ├── index.js
│   ├── index.ts
│   ├── package.json
│   ├── qualitativeresearch_advancedcontext.txt
│   ├── qualitativeresearch_buildcontext.txt
│   ├── qualitativeresearch_deletecontext.txt
│   ├── qualitativeresearch_endsession_examples.txt
│   ├── qualitativeresearch_endsession.txt
│   ├── qualitativeresearch_loadcontext.txt
│   ├── qualitativeresearch_startsession.txt
│   ├── README.md
│   └── tsconfig.json
├── quantitativeresearch
│   ├── .gitattributes
│   ├── Dockerfile
│   ├── index.d.ts
│   ├── index.js
│   ├── index.ts
│   ├── package.json
│   ├── quantitativeresearch_advancedcontext.txt
│   ├── quantitativeresearch_buildcontext.txt
│   ├── quantitativeresearch_deletecontext.txt
│   ├── quantitativeresearch_endsession_examples.txt
│   ├── quantitativeresearch_endsession.txt
│   ├── quantitativeresearch_loadcontext.txt
│   ├── quantitativeresearch_startsession.txt
│   ├── README.md
│   └── tsconfig.json
├── README.md
├── student
│   ├── .gitattributes
│   ├── Dockerfile
│   ├── index.d.ts
│   ├── index.js
│   ├── index.ts
│   ├── package.json
│   ├── README.md
│   ├── student_advancedcontext.txt
│   ├── student_buildcontext.txt
│   ├── student_deletecontext.txt
│   ├── student_endsession_examples.txt
│   ├── student_endsession.txt
│   ├── student_loadcontext.txt
│   ├── student_startsession.txt
│   └── tsconfig.json
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/main/descriptions/quantitativeresearch_buildcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A versatile tool for constructing and enhancing the quantitative research knowledge graph by adding new research elements, relationships, and observations.
  2 | 
  3 | When to use this tool:
  4 | - Creating new research entities (projects, datasets, variables, hypotheses, statistical tests, etc.)
  5 | - Establishing relationships between research elements (e.g., connecting variables to datasets, statistical tests to hypotheses)
  6 | - Adding observations, properties, or metadata to existing research entities
  7 | - Building the research corpus incrementally as data collection and analysis progress
  8 | - Organizing and structuring quantitative data within your research framework
  9 | - Documenting statistical analyses, models, and their results
 10 | - Tracking research questions and linking them to findings
 11 | - Creating visualizations and connecting them to data and analyses
 12 | - Setting status values for research activities and entities
 13 | - Assigning priorities to research tasks and activities
 14 | - Defining sequential relationships between research processes
 15 | 
 16 | Key features:
 17 | - Creates three distinct types of knowledge graph elements: entities, relations, and observations
 18 | - Supports specialized quantitative research entity types (projects, datasets, variables, hypotheses, statistical tests, etc.)
 19 | - Validates entity and relation types against predefined standards for the quantitative research domain
 20 | - Handles batch creation of multiple entities or relations in a single operation
 21 | - Returns confirmation with details of created elements
 22 | - Ensures proper data typing and structure for the quantitative research knowledge graph
 23 | - Enables comprehensive documentation of statistical analysis processes
 24 | - Supports status and priority assignment through entity-relation model
 25 | - Enables sequential relationships through precedes relation
 26 | 
 27 | Parameters explained:
 28 | 1. type: The type of creation operation to perform
 29 |   - Accepts: "entities", "relations", or "observations"
 30 |   - Determines how the data parameter is interpreted
 31 | 2. data: The content to add to the knowledge graph (structure varies by type):
 32 |   - For "entities": An array of objects, each containing:
 33 |     * name: Unique identifier for the entity
 34 |     * entityType: One of the valid entity types (project, dataset, variable, hypothesis, statisticalTest, result, analysisScript, visualization, model, literature, researchQuestion, finding, participant, status, priority)
 35 |     * observations: Array of strings containing notes or properties about the entity
 36 |   - For "relations": An array of objects, each containing:
 37 |     * from: Name of the source entity
 38 |     * to: Name of the target entity
 39 |     * relationType: The type of relationship between entities (e.g., correlates_with, predicts, tests, analyzes, produces, has_status, has_priority, precedes)
 40 |   - For "observations": Either a single object or an array of objects, each containing:
 41 |     * entityName: Name of the entity to add observations to
 42 |     * contents: Array of strings with new observations to add
 43 | 
 44 | Valid entity types:
 45 | - project: Overall research study
 46 | - dataset: Collection of data used for analysis
 47 | - variable: Specific measurable attribute in a dataset
 48 | - hypothesis: Formal testable statement
 49 | - statisticalTest: Analysis method applied to data
 50 | - result: Outcome of statistical analysis
 51 | - analysisScript: Code used to perform analysis
 52 | - visualization: Visual representation of data
 53 | - model: Statistical/mathematical model
 54 | - literature: Academic sources
 55 | - researchQuestion: Formal questions guiding the study
 56 | - finding: Results or conclusions
 57 | - participant: Research subjects
 58 | - status: Entity status values
 59 | - priority: Entity priority values
 60 | 
 61 | Valid relation types:
 62 | - correlates_with: Statistical correlation between variables
 63 | - predicts: Predictive relationship from independent to dependent variable
 64 | - tests: Statistical test examines hypothesis
 65 | - analyzes: Analysis performed on dataset
 66 | - produces: Analysis produces result
 67 | - visualizes: Visualization displays data or result
 68 | - contains: Hierarchical relationship
 69 | - part_of: Entity is part of another entity
 70 | - depends_on: Dependency relationship
 71 | - supports: Evidence supporting a hypothesis or finding
 72 | - contradicts: Evidence contradicting a hypothesis or finding
 73 | - derived_from: Entity is derived from another entity
 74 | - controls_for: Variable/method controls for confounds
 75 | - moderates: Variable moderates a relationship
 76 | - mediates: Variable mediates a relationship
 77 | - implements: Script implements statistical test/model
 78 | - compares: Statistical comparison between groups/variables
 79 | - includes: Model includes variables
 80 | - validates: Validates a model or result
 81 | - cites: References literature
 82 | - has_status: Links entity to its status
 83 | - has_priority: Links entity to its priority
 84 | - precedes: Entity comes before another entity in sequence
 85 | 
 86 | Status information:
 87 | - Valid status values include: active, completed, pending, abandoned
 88 | - Status is assigned through the has_status relation type
 89 | - Status helps track progress of research activities
 90 | 
 91 | Priority information:
 92 | - Valid priority values: high, low
 93 | - Priority is assigned through the has_priority relation type
 94 | - Priority helps identify critical research tasks
 95 | 
 96 | Sequential Process Information:
 97 | - The precedes relation establishes logical ordering between research processes
 98 | - Sequential relationships document the flow of the research methodology
 99 | - Helps maintain proper order in multi-step analysis procedures
100 | 
101 | Return information:
102 | - JSON response indicating success or failure
103 | - For successful operations:
104 |   * Success flag set to true
105 |   * Details of created elements in the "created" field (for entities/relations) or "added" field (for observations)
106 | - For failed operations:
107 |   * Success flag set to false
108 |   * Error message describing the issue
109 | 
110 | Error handling:
111 | - Validates entity types against the predefined list for quantitative research
112 | - Validates relation types against acceptable standards
113 | - Returns descriptive error messages for invalid inputs
114 | - Gracefully handles type mismatches and formatting errors
115 | 
116 | You should:
117 | - Use consistent naming conventions for entities to facilitate relationships and retrieval
118 | - Begin by creating projects and datasets before more specific research elements
119 | - Add detailed observations to entities to enhance context and retrievability
120 | - Create relationships to build a comprehensive network of interconnected research data
121 | - Document statistical methodology thoroughly by connecting tests, variables, and hypotheses
122 | - Add statistical results with appropriate metadata (p-values, effect sizes, confidence intervals)
123 | - Create visualizations and link them to the data they represent
124 | - Use relations to document the flow of analysis from data to findings
125 | - Connect literature to support hypotheses and contextualize findings
126 | - Structure models with clear relationships to the variables they include
127 | - Document analysis scripts with information about their purpose and implementation
128 | - Use has_status relations to track the progress of research activities (active, completed, pending, abandoned)
129 | - Use has_priority relations to indicate important research elements (high, low)
130 | - Use precedes relations to establish sequences in research methodologies 
```

--------------------------------------------------------------------------------
/quantitativeresearch/quantitativeresearch_buildcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A versatile tool for constructing and enhancing the quantitative research knowledge graph by adding new research elements, relationships, and observations.
  2 | 
  3 | When to use this tool:
  4 | - Creating new research entities (projects, datasets, variables, hypotheses, statistical tests, etc.)
  5 | - Establishing relationships between research elements (e.g., connecting variables to datasets, statistical tests to hypotheses)
  6 | - Adding observations, properties, or metadata to existing research entities
  7 | - Building the research corpus incrementally as data collection and analysis progress
  8 | - Organizing and structuring quantitative data within your research framework
  9 | - Documenting statistical analyses, models, and their results
 10 | - Tracking research questions and linking them to findings
 11 | - Creating visualizations and connecting them to data and analyses
 12 | - Setting status values for research activities and entities
 13 | - Assigning priorities to research tasks and activities
 14 | - Defining sequential relationships between research processes
 15 | 
 16 | Key features:
 17 | - Creates three distinct types of knowledge graph elements: entities, relations, and observations
 18 | - Supports specialized quantitative research entity types (projects, datasets, variables, hypotheses, statistical tests, etc.)
 19 | - Validates entity and relation types against predefined standards for the quantitative research domain
 20 | - Handles batch creation of multiple entities or relations in a single operation
 21 | - Returns confirmation with details of created elements
 22 | - Ensures proper data typing and structure for the quantitative research knowledge graph
 23 | - Enables comprehensive documentation of statistical analysis processes
 24 | - Supports status and priority assignment through entity-relation model
 25 | - Enables sequential relationships through precedes relation
 26 | 
 27 | Parameters explained:
 28 | 1. type: The type of creation operation to perform
 29 |   - Accepts: "entities", "relations", or "observations"
 30 |   - Determines how the data parameter is interpreted
 31 | 2. data: The content to add to the knowledge graph (structure varies by type):
 32 |   - For "entities": An array of objects, each containing:
 33 |     * name: Unique identifier for the entity
 34 |     * entityType: One of the valid entity types (project, dataset, variable, hypothesis, statisticalTest, result, analysisScript, visualization, model, literature, researchQuestion, finding, participant, status, priority)
 35 |     * observations: Array of strings containing notes or properties about the entity
 36 |   - For "relations": An array of objects, each containing:
 37 |     * from: Name of the source entity
 38 |     * to: Name of the target entity
 39 |     * relationType: The type of relationship between entities (e.g., correlates_with, predicts, tests, analyzes, produces, has_status, has_priority, precedes)
 40 |   - For "observations": Either a single object or an array of objects, each containing:
 41 |     * entityName: Name of the entity to add observations to
 42 |     * contents: Array of strings with new observations to add
 43 | 
 44 | Valid entity types:
 45 | - project: Overall research study
 46 | - dataset: Collection of data used for analysis
 47 | - variable: Specific measurable attribute in a dataset
 48 | - hypothesis: Formal testable statement
 49 | - statisticalTest: Analysis method applied to data
 50 | - result: Outcome of statistical analysis
 51 | - analysisScript: Code used to perform analysis
 52 | - visualization: Visual representation of data
 53 | - model: Statistical/mathematical model
 54 | - literature: Academic sources
 55 | - researchQuestion: Formal questions guiding the study
 56 | - finding: Results or conclusions
 57 | - participant: Research subjects
 58 | - status: Entity status values
 59 | - priority: Entity priority values
 60 | 
 61 | Valid relation types:
 62 | - correlates_with: Statistical correlation between variables
 63 | - predicts: Predictive relationship from independent to dependent variable
 64 | - tests: Statistical test examines hypothesis
 65 | - analyzes: Analysis performed on dataset
 66 | - produces: Analysis produces result
 67 | - visualizes: Visualization displays data or result
 68 | - contains: Hierarchical relationship
 69 | - part_of: Entity is part of another entity
 70 | - depends_on: Dependency relationship
 71 | - supports: Evidence supporting a hypothesis or finding
 72 | - contradicts: Evidence contradicting a hypothesis or finding
 73 | - derived_from: Entity is derived from another entity
 74 | - controls_for: Variable/method controls for confounds
 75 | - moderates: Variable moderates a relationship
 76 | - mediates: Variable mediates a relationship
 77 | - implements: Script implements statistical test/model
 78 | - compares: Statistical comparison between groups/variables
 79 | - includes: Model includes variables
 80 | - validates: Validates a model or result
 81 | - cites: References literature
 82 | - has_status: Links entity to its status
 83 | - has_priority: Links entity to its priority
 84 | - precedes: Entity comes before another entity in sequence
 85 | 
 86 | Status information:
 87 | - Valid status values include: active, completed, pending, abandoned
 88 | - Status is assigned through the has_status relation type
 89 | - Status helps track progress of research activities
 90 | 
 91 | Priority information:
 92 | - Valid priority values: high, low
 93 | - Priority is assigned through the has_priority relation type
 94 | - Priority helps identify critical research tasks
 95 | 
 96 | Sequential Process Information:
 97 | - The precedes relation establishes logical ordering between research processes
 98 | - Sequential relationships document the flow of the research methodology
 99 | - Helps maintain proper order in multi-step analysis procedures
100 | 
101 | Return information:
102 | - JSON response indicating success or failure
103 | - For successful operations:
104 |   * Success flag set to true
105 |   * Details of created elements in the "created" field (for entities/relations) or "added" field (for observations)
106 | - For failed operations:
107 |   * Success flag set to false
108 |   * Error message describing the issue
109 | 
110 | Error handling:
111 | - Validates entity types against the predefined list for quantitative research
112 | - Validates relation types against acceptable standards
113 | - Returns descriptive error messages for invalid inputs
114 | - Gracefully handles type mismatches and formatting errors
115 | 
116 | You should:
117 | - Use consistent naming conventions for entities to facilitate relationships and retrieval
118 | - Begin by creating projects and datasets before more specific research elements
119 | - Add detailed observations to entities to enhance context and retrievability
120 | - Create relationships to build a comprehensive network of interconnected research data
121 | - Document statistical methodology thoroughly by connecting tests, variables, and hypotheses
122 | - Add statistical results with appropriate metadata (p-values, effect sizes, confidence intervals)
123 | - Create visualizations and link them to the data they represent
124 | - Use relations to document the flow of analysis from data to findings
125 | - Connect literature to support hypotheses and contextualize findings
126 | - Structure models with clear relationships to the variables they include
127 | - Document analysis scripts with information about their purpose and implementation
128 | - Use has_status relations to track the progress of research activities (active, completed, pending, abandoned)
129 | - Use has_priority relations to indicate important research elements (high, low)
130 | - Use precedes relations to establish sequences in research methodologies 
```

--------------------------------------------------------------------------------
/main/descriptions/project_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting project management sessions, recording achievements, tracking task updates, and creating a structured record of project evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a project planning or review session
  5 | - Documenting decisions made during team meetings
  6 | - Recording updates to tasks and their status
  7 | - Tracking new tasks created during work sessions
  8 | - Documenting changes to project risk assessments
  9 | - Updating overall project status information
 10 | - Creating a structured record of project activities
 11 | - Establishing a formal conclusion to a focused work period
 12 | - Building a historical record of project development
 13 | - Preserving context for future team members or sessions
 14 | - Updating entity status values and tracking progress
 15 | - Modifying task priorities as project needs evolve
 16 | - Establishing or modifying sequential relationships between tasks
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for project session documentation
 20 | - Records project decisions and achievements in the knowledge graph
 21 | - Captures task status updates and progress information
 22 | - Tracks creation of new tasks with descriptions and priorities
 23 | - Documents risk updates with impact and probability assessments
 24 | - Updates project status information
 25 | - Maintains session continuity with unique session IDs
 26 | - Supports revision of previous stages when needed
 27 | - Offers a comprehensive assembly stage that consolidates all session information
 28 | - Manages status progression of project entities via has_status relations
 29 | - Tracks priority assignments for tasks via has_priority relations
 30 | - Documents sequential task relationships via precedes relations
 31 | 
 32 | The endsession tool uses a sequential, multi-stage approach with 7 typical stages:
 33 | 1. Summary Stage: Records basic session information
 34 | 2. Achievements Stage: Documents decisions and accomplishments
 35 | 3. Task Updates Stage: Records changes to existing tasks
 36 | 4. New Tasks Stage: Documents newly created tasks
 37 | 5. Status Updates Stage: Records changes to entity status values
 38 | 6. Project Status Stage: Updates the overall project status
 39 | 7. Assembly Stage: Consolidates all information and finalizes the session record
 40 | 
 41 | Parameters explained:
 42 | 1. sessionId: Required - Unique identifier for the project session
 43 |   - Obtained from the startsession tool
 44 |   - Example: "proj_1234567890_abc123"
 45 | 2. stage: Required - Current stage of the endsession workflow
 46 |   - Accepts: "summary", "achievements", "taskUpdates", "newTasks", "statusUpdates", "projectStatus", or "assembly"
 47 |   - Each stage has specific data requirements and processing logic
 48 | 3. stageNumber: Required - The sequence number of the current stage
 49 |   - Starts at 1 and typically progresses through the stages
 50 |   - Used to track progress through the session documentation workflow
 51 | 4. totalStages: Required - Total number of stages planned for this workflow
 52 |   - Typically 7 for the complete workflow
 53 |   - Provides context for the progress within the overall process
 54 | 5. analysis: Optional - Text analysis or observations for the current stage
 55 |   - Descriptive text explaining the work done in this stage
 56 |   - Example: "Analyzed progress on the marketing campaign project"
 57 | 6. stageData: Optional - Stage-specific structured data
 58 |   - Structure varies by stage type:
 59 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 60 |     * achievements: { achievements: ["Decision 1", "Accomplishment 2"] }
 61 |     * taskUpdates: { updates: [{ name: "Task1", status: "active", progress: "50%" }] }
 62 |     * newTasks: { tasks: [{ name: "New Task", description: "Details", priority: "high", precedes: "Task3" }] }
 63 |     * statusUpdates: { statusUpdates: [{ entityName: "Task1", newStatus: "complete", note: "Finished implementation" }, { entityName: "Risk1", newStatus: "inactive", note: "Risk mitigated" }] }
 64 |     * projectStatus: { projectStatus: "active", projectObservation: "Good progress", priorityUpdates: [{ entityName: "Task2", priority: "high", note: "Critical for launch" }], sequenceUpdates: [{ before: "Task1", after: "Task4", note: "Rearranged sequence to optimize workflow" }] }
 65 |     * assembly: No stageData needed - automatically assembled from previous stages
 66 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 67 |   - Boolean value (true/false)
 68 |   - Set to false on the final stage to complete the session
 69 | 8. isRevision: Optional - Whether this is revising a previous stage
 70 |   - Boolean value (true/false)
 71 |   - Default: false
 72 | 9. revisesStage: Optional - If revising, which stage number is being revised
 73 |   - Required when isRevision is true
 74 |   - Indicates which previous stage is being updated
 75 | 
 76 | Status and Priority Management:
 77 | - The statusUpdates stage allows for batch updates to entity status values
 78 | - Valid status values include: inactive, active, complete
 79 | - Priority assignments (high, low) can be modified in the projectStatus stage
 80 | - Status changes are implemented through has_status relations
 81 | - Priority changes are implemented through has_priority relations
 82 | - Status and priority changes are tracked to maintain project progress history
 83 | 
 84 | Sequential Task Management:
 85 | - The projectStatus stage allows for defining or modifying sequential relationships
 86 | - The precedes relation is used to establish logical ordering between tasks
 87 | - New tasks can specify which tasks they precede or follow
 88 | - Sequential updates help maintain a coherent project workflow
 89 | - Task sequences can be visualized through the loadcontext tool
 90 | 
 91 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool performs these actions:
 92 | 1. Records the session completion in persistent storage
 93 | 2. Creates a summary of all documented information
 94 | 3. Updates the project status in the knowledge graph
 95 | 4. Links all achievements, task updates, and risk information
 96 | 5. Updates status, priority, and sequential relationships for relevant entities
 97 | 
 98 | Return information:
 99 | - JSON response with the following structure when stages are in progress:
100 |   * success: Boolean indicating whether the operation succeeded
101 |   * stageCompleted: The stage that was just completed
102 |   * nextStageNeeded: Whether more stages are required
103 |   * stageResult: The processed result of the current stage
104 | - Formatted markdown text summary when the session is completed, including:
105 |   * Session date and project name
106 |   * Decisions documented
107 |   * Task updates
108 |   * Status changes
109 |   * Priority modifications
110 |   * Task sequencing changes
111 |   * Project status
112 |   * New tasks added
113 |   * Risk updates
114 |   * Session summary
115 | 
116 | You should:
117 | - Complete all stages in order for comprehensive session documentation
118 | - Provide specific details in each stage for accurate project documentation
119 | - Specify task updates with clear status information using valid values (inactive, active, complete)
120 | - Include priority levels (high, low) when adding new tasks or updating priorities
121 | - Document all key decisions made during the session as achievements
122 | - Update entity status using has_status relations with valid status values
123 | - Define task sequences using precedes relations to establish workflow
124 | - If making a revision, specify which stage is being revised
125 | - Only mark nextStageNeeded as false on the final assembly stage
126 | - Review the final summary message to confirm all session details were recorded properly
127 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/project/project_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting project management sessions, recording achievements, tracking task updates, and creating a structured record of project evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a project planning or review session
  5 | - Documenting decisions made during team meetings
  6 | - Recording updates to tasks and their status
  7 | - Tracking new tasks created during work sessions
  8 | - Documenting changes to project risk assessments
  9 | - Updating overall project status information
 10 | - Creating a structured record of project activities
 11 | - Establishing a formal conclusion to a focused work period
 12 | - Building a historical record of project development
 13 | - Preserving context for future team members or sessions
 14 | - Updating entity status values and tracking progress
 15 | - Modifying task priorities as project needs evolve
 16 | - Establishing or modifying sequential relationships between tasks
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for project session documentation
 20 | - Records project decisions and achievements in the knowledge graph
 21 | - Captures task status updates and progress information
 22 | - Tracks creation of new tasks with descriptions and priorities
 23 | - Documents risk updates with impact and probability assessments
 24 | - Updates project status information
 25 | - Maintains session continuity with unique session IDs
 26 | - Supports revision of previous stages when needed
 27 | - Offers a comprehensive assembly stage that consolidates all session information
 28 | - Manages status progression of project entities via has_status relations
 29 | - Tracks priority assignments for tasks via has_priority relations
 30 | - Documents sequential task relationships via precedes relations
 31 | 
 32 | The endsession tool uses a sequential, multi-stage approach with 7 typical stages:
 33 | 1. Summary Stage: Records basic session information
 34 | 2. Achievements Stage: Documents decisions and accomplishments
 35 | 3. Task Updates Stage: Records changes to existing tasks
 36 | 4. New Tasks Stage: Documents newly created tasks
 37 | 5. Status Updates Stage: Records changes to entity status values
 38 | 6. Project Status Stage: Updates the overall project status
 39 | 7. Assembly Stage: Consolidates all information and finalizes the session record
 40 | 
 41 | Parameters explained:
 42 | 1. sessionId: Required - Unique identifier for the project session
 43 |   - Obtained from the startsession tool
 44 |   - Example: "proj_1234567890_abc123"
 45 | 2. stage: Required - Current stage of the endsession workflow
 46 |   - Accepts: "summary", "achievements", "taskUpdates", "newTasks", "statusUpdates", "projectStatus", or "assembly"
 47 |   - Each stage has specific data requirements and processing logic
 48 | 3. stageNumber: Required - The sequence number of the current stage
 49 |   - Starts at 1 and typically progresses through the stages
 50 |   - Used to track progress through the session documentation workflow
 51 | 4. totalStages: Required - Total number of stages planned for this workflow
 52 |   - Typically 7 for the complete workflow
 53 |   - Provides context for the progress within the overall process
 54 | 5. analysis: Optional - Text analysis or observations for the current stage
 55 |   - Descriptive text explaining the work done in this stage
 56 |   - Example: "Analyzed progress on the marketing campaign project"
 57 | 6. stageData: Optional - Stage-specific structured data
 58 |   - Structure varies by stage type:
 59 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 60 |     * achievements: { achievements: ["Decision 1", "Accomplishment 2"] }
 61 |     * taskUpdates: { updates: [{ name: "Task1", status: "active", progress: "50%" }] }
 62 |     * newTasks: { tasks: [{ name: "New Task", description: "Details", priority: "high", precedes: "Task3" }] }
 63 |     * statusUpdates: { statusUpdates: [{ entityName: "Task1", newStatus: "complete", note: "Finished implementation" }, { entityName: "Risk1", newStatus: "inactive", note: "Risk mitigated" }] }
 64 |     * projectStatus: { projectStatus: "active", projectObservation: "Good progress", priorityUpdates: [{ entityName: "Task2", priority: "high", note: "Critical for launch" }], sequenceUpdates: [{ before: "Task1", after: "Task4", note: "Rearranged sequence to optimize workflow" }] }
 65 |     * assembly: No stageData needed - automatically assembled from previous stages
 66 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 67 |   - Boolean value (true/false)
 68 |   - Set to false on the final stage to complete the session
 69 | 8. isRevision: Optional - Whether this is revising a previous stage
 70 |   - Boolean value (true/false)
 71 |   - Default: false
 72 | 9. revisesStage: Optional - If revising, which stage number is being revised
 73 |   - Required when isRevision is true
 74 |   - Indicates which previous stage is being updated
 75 | 
 76 | Status and Priority Management:
 77 | - The statusUpdates stage allows for batch updates to entity status values
 78 | - Valid status values include: inactive, active, complete
 79 | - Priority assignments (high, low) can be modified in the projectStatus stage
 80 | - Status changes are implemented through has_status relations
 81 | - Priority changes are implemented through has_priority relations
 82 | - Status and priority changes are tracked to maintain project progress history
 83 | 
 84 | Sequential Task Management:
 85 | - The projectStatus stage allows for defining or modifying sequential relationships
 86 | - The precedes relation is used to establish logical ordering between tasks
 87 | - New tasks can specify which tasks they precede or follow
 88 | - Sequential updates help maintain a coherent project workflow
 89 | - Task sequences can be visualized through the loadcontext tool
 90 | 
 91 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool performs these actions:
 92 | 1. Records the session completion in persistent storage
 93 | 2. Creates a summary of all documented information
 94 | 3. Updates the project status in the knowledge graph
 95 | 4. Links all achievements, task updates, and risk information
 96 | 5. Updates status, priority, and sequential relationships for relevant entities
 97 | 
 98 | Return information:
 99 | - JSON response with the following structure when stages are in progress:
100 |   * success: Boolean indicating whether the operation succeeded
101 |   * stageCompleted: The stage that was just completed
102 |   * nextStageNeeded: Whether more stages are required
103 |   * stageResult: The processed result of the current stage
104 | - Formatted markdown text summary when the session is completed, including:
105 |   * Session date and project name
106 |   * Decisions documented
107 |   * Task updates
108 |   * Status changes
109 |   * Priority modifications
110 |   * Task sequencing changes
111 |   * Project status
112 |   * New tasks added
113 |   * Risk updates
114 |   * Session summary
115 | 
116 | You should:
117 | - Complete all stages in order for comprehensive session documentation
118 | - Provide specific details in each stage for accurate project documentation
119 | - Specify task updates with clear status information using valid values (inactive, active, complete)
120 | - Include priority levels (high, low) when adding new tasks or updating priorities
121 | - Document all key decisions made during the session as achievements
122 | - Update entity status using has_status relations with valid status values
123 | - Define task sequences using precedes relations to establish workflow
124 | - If making a revision, specify which stage is being revised
125 | - Only mark nextStageNeeded as false on the final assembly stage
126 | - Review the final summary message to confirm all session details were recorded properly
127 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/main/descriptions/qualitativeresearch_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the qualitative research knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire research knowledge structure
  5 | - Searching for specific research entities across your qualitative data corpus
  6 | - Getting detailed information about particular research projects, participants, or analytical elements
  7 | - Exploring relationships between research components (codes, themes, quotes)
  8 | - Analyzing code frequencies and distributions across your data
  9 | - Retrieving interview or observation transcripts for analysis
 10 | - Accessing memo content for reflection on the research process
 11 | - Generating codebooks or analytical frameworks for documentation
 12 | - Finding connections between different aspects of your research
 13 | - Creating research reports or summaries from your data
 14 | - Exploring thematic structures and their evidentiary basis
 15 | - Identifying entities by status to track research progress
 16 | - Filtering tasks by priority to manage research workflow
 17 | - Analyzing sequential relationships between research processes
 18 | 
 19 | Key features:
 20 | - Offers specialized operations for querying different aspects of qualitative research data
 21 | - Retrieves complete or filtered views of the research knowledge graph
 22 | - Provides flexible search capabilities across all research entities
 23 | - Supports detailed exploration of specific entities by name
 24 | - Generates specialized views for projects, participants, codes, and themes
 25 | - Retrieves content and metadata for interviews, transcripts, and memos
 26 | - Creates codebooks and thematic frameworks for documentation
 27 | - Identifies related entities to explore connections within your research
 28 | - Returns consistently structured JSON responses for easy processing
 29 | - Facilitates depth and breadth exploration of qualitative data
 30 | - Supports status-based filtering of research entities
 31 | - Enables priority-based task management
 32 | - Provides sequential process analysis capabilities
 33 | 
 34 | Parameters explained:
 35 | 1. type: The type of query operation to perform
 36 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "participant", "codes", "themes", "transcript", "memo", "analysis", "codebook", "related", "status", "priority", "sequence"
 37 |   - Determines how the params parameter is interpreted 
 38 | 2. params: Operation-specific parameters (structure varies by type):
 39 |   - For "graph": No parameters needed (retrieves the full research knowledge graph)
 40 |   - For "search": Object containing:
 41 |     * query: Search string to find entities (supports entity type filters)
 42 |   - For "nodes": Object containing:
 43 |     * names: Array of entity names to retrieve
 44 |   - For "project": Object containing:
 45 |     * projectName: Name of the project to retrieve details for
 46 |   - For "participant": Object containing:
 47 |     * participantName: Name of the participant to retrieve profile for
 48 |   - For "codes": Object containing:
 49 |     * projectName: (Optional) Project name to filter codes by
 50 |   - For "themes": Object containing:
 51 |     * projectName: (Optional) Project name to filter themes by
 52 |   - For "transcript": Object containing:
 53 |     * participantName: Participant associated with the transcript
 54 |     * interviewId: (Optional) Specific interview identifier
 55 |   - For "memo": Object containing:
 56 |     * memoName: Name of the memo to retrieve
 57 |   - For "analysis": Object containing:
 58 |     * projectName: Project name to retrieve analysis artifacts for
 59 |   - For "codebook": Object containing:
 60 |     * projectName: Project name to generate codebook for
 61 |   - For "related": Object containing:
 62 |     * entityName: Name of the entity to find related entities for
 63 |   - For "status": Object containing:
 64 |     * statusValue: The status value to filter by (e.g., "planning", "data_collection", "analysis")
 65 |   - For "priority": Object containing:
 66 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 67 |   - For "sequence": Object containing:
 68 |     * entityName: Name of the entity to find sequential relationships for
 69 | 
 70 | Operation details:
 71 | - graph: Returns the complete research knowledge graph with all entities and relationships
 72 | - search: Performs text-based search across entity names and observations
 73 | - nodes: Retrieves detailed information about specific entities by name
 74 | - project: Returns comprehensive project information including participants, interviews, codes, and findings
 75 | - participant: Generates a participant profile with demographic information and associated data
 76 | - codes: Lists all codes, optionally filtered by project, with reference counts and descriptions
 77 | - themes: Returns all themes, optionally filtered by project, with associated codes and descriptions
 78 | - transcript: Retrieves interview transcript content for specific participant/interview combinations
 79 | - memo: Returns the full content of an analytical memo with metadata
 80 | - analysis: Collects all analysis artifacts (codes, themes, memos) for a specific project
 81 | - codebook: Generates a structured codebook for a project with code definitions and examples
 82 | - related: Identifies all entities directly connected to a specific entity
 83 | - status: Retrieves all entities with a specific status value
 84 | - priority: Retrieves all entities with a specific priority value
 85 | - sequence: Identifies sequential relationships for a specific entity showing preceding and following entities
 86 | 
 87 | Status and Priority Information:
 88 | - Status queries return entities organized by their current research stage
 89 | - Priority queries help identify critical research tasks and elements
 90 | - Status values include: planning, data_collection, analysis, writing, complete, scheduled, conducted, transcribed, coded, analyzed, emerging, developing, established, preliminary, draft, final, active, in_progress
 91 | - Priority values include: high, low
 92 | 
 93 | Sequential Process Information:
 94 | - Sequence queries identify entities that come before or after in a research process
 95 | - Sequential relationships help visualize the research workflow
 96 | - The sequence operation shows both incoming and outgoing precedes relations
 97 | 
 98 | Return information:
 99 | - JSON response with a consistent structure:
100 |   - success: Boolean indicating whether the operation succeeded
101 |   - Additional fields depend on the operation type:
102 |     * graph: Complete knowledge graph
103 |     * results: For search operations
104 |     * nodes: For specific entity retrieval
105 |     * project/participant/etc.: For specialized views
106 |     * status/priority: Lists of entities with specified status/priority values
107 |     * sequence: Preceding and following entities in research processes
108 | - Error information when operations fail
109 | 
110 | You should:
111 | - Start with broad queries ("graph", "search") to explore your research corpus
112 | - Use specific entity queries ("nodes", "project", "participant") for detailed information
113 | - Combine search and related queries to discover connections in your data
114 | - Generate codebooks and project overviews for documentation and reporting
115 | - Use transcript retrieval to access primary data when needed
116 | - Explore thematic structures through themes and related entity queries
117 | - Review memos to track your analytical process over time
118 | - Filter code and theme queries by project for more focused results
119 | - Use search with entity type filters to find specific types of research elements
120 | - Use status queries to identify all entities at a particular research stage
121 | - Use priority queries to focus on high-priority research tasks
122 | - Use sequence queries to understand process flows in your research methodology 
```

--------------------------------------------------------------------------------
/qualitativeresearch/qualitativeresearch_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the qualitative research knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire research knowledge structure
  5 | - Searching for specific research entities across your qualitative data corpus
  6 | - Getting detailed information about particular research projects, participants, or analytical elements
  7 | - Exploring relationships between research components (codes, themes, quotes)
  8 | - Analyzing code frequencies and distributions across your data
  9 | - Retrieving interview or observation transcripts for analysis
 10 | - Accessing memo content for reflection on the research process
 11 | - Generating codebooks or analytical frameworks for documentation
 12 | - Finding connections between different aspects of your research
 13 | - Creating research reports or summaries from your data
 14 | - Exploring thematic structures and their evidentiary basis
 15 | - Identifying entities by status to track research progress
 16 | - Filtering tasks by priority to manage research workflow
 17 | - Analyzing sequential relationships between research processes
 18 | 
 19 | Key features:
 20 | - Offers specialized operations for querying different aspects of qualitative research data
 21 | - Retrieves complete or filtered views of the research knowledge graph
 22 | - Provides flexible search capabilities across all research entities
 23 | - Supports detailed exploration of specific entities by name
 24 | - Generates specialized views for projects, participants, codes, and themes
 25 | - Retrieves content and metadata for interviews, transcripts, and memos
 26 | - Creates codebooks and thematic frameworks for documentation
 27 | - Identifies related entities to explore connections within your research
 28 | - Returns consistently structured JSON responses for easy processing
 29 | - Facilitates depth and breadth exploration of qualitative data
 30 | - Supports status-based filtering of research entities
 31 | - Enables priority-based task management
 32 | - Provides sequential process analysis capabilities
 33 | 
 34 | Parameters explained:
 35 | 1. type: The type of query operation to perform
 36 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "participant", "codes", "themes", "transcript", "memo", "analysis", "codebook", "related", "status", "priority", "sequence"
 37 |   - Determines how the params parameter is interpreted 
 38 | 2. params: Operation-specific parameters (structure varies by type):
 39 |   - For "graph": No parameters needed (retrieves the full research knowledge graph)
 40 |   - For "search": Object containing:
 41 |     * query: Search string to find entities (supports entity type filters)
 42 |   - For "nodes": Object containing:
 43 |     * names: Array of entity names to retrieve
 44 |   - For "project": Object containing:
 45 |     * projectName: Name of the project to retrieve details for
 46 |   - For "participant": Object containing:
 47 |     * participantName: Name of the participant to retrieve profile for
 48 |   - For "codes": Object containing:
 49 |     * projectName: (Optional) Project name to filter codes by
 50 |   - For "themes": Object containing:
 51 |     * projectName: (Optional) Project name to filter themes by
 52 |   - For "transcript": Object containing:
 53 |     * participantName: Participant associated with the transcript
 54 |     * interviewId: (Optional) Specific interview identifier
 55 |   - For "memo": Object containing:
 56 |     * memoName: Name of the memo to retrieve
 57 |   - For "analysis": Object containing:
 58 |     * projectName: Project name to retrieve analysis artifacts for
 59 |   - For "codebook": Object containing:
 60 |     * projectName: Project name to generate codebook for
 61 |   - For "related": Object containing:
 62 |     * entityName: Name of the entity to find related entities for
 63 |   - For "status": Object containing:
 64 |     * statusValue: The status value to filter by (e.g., "planning", "data_collection", "analysis")
 65 |   - For "priority": Object containing:
 66 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 67 |   - For "sequence": Object containing:
 68 |     * entityName: Name of the entity to find sequential relationships for
 69 | 
 70 | Operation details:
 71 | - graph: Returns the complete research knowledge graph with all entities and relationships
 72 | - search: Performs text-based search across entity names and observations
 73 | - nodes: Retrieves detailed information about specific entities by name
 74 | - project: Returns comprehensive project information including participants, interviews, codes, and findings
 75 | - participant: Generates a participant profile with demographic information and associated data
 76 | - codes: Lists all codes, optionally filtered by project, with reference counts and descriptions
 77 | - themes: Returns all themes, optionally filtered by project, with associated codes and descriptions
 78 | - transcript: Retrieves interview transcript content for specific participant/interview combinations
 79 | - memo: Returns the full content of an analytical memo with metadata
 80 | - analysis: Collects all analysis artifacts (codes, themes, memos) for a specific project
 81 | - codebook: Generates a structured codebook for a project with code definitions and examples
 82 | - related: Identifies all entities directly connected to a specific entity
 83 | - status: Retrieves all entities with a specific status value
 84 | - priority: Retrieves all entities with a specific priority value
 85 | - sequence: Identifies sequential relationships for a specific entity showing preceding and following entities
 86 | 
 87 | Status and Priority Information:
 88 | - Status queries return entities organized by their current research stage
 89 | - Priority queries help identify critical research tasks and elements
 90 | - Status values include: planning, data_collection, analysis, writing, complete, scheduled, conducted, transcribed, coded, analyzed, emerging, developing, established, preliminary, draft, final, active, in_progress
 91 | - Priority values include: high, low
 92 | 
 93 | Sequential Process Information:
 94 | - Sequence queries identify entities that come before or after in a research process
 95 | - Sequential relationships help visualize the research workflow
 96 | - The sequence operation shows both incoming and outgoing precedes relations
 97 | 
 98 | Return information:
 99 | - JSON response with a consistent structure:
100 |   - success: Boolean indicating whether the operation succeeded
101 |   - Additional fields depend on the operation type:
102 |     * graph: Complete knowledge graph
103 |     * results: For search operations
104 |     * nodes: For specific entity retrieval
105 |     * project/participant/etc.: For specialized views
106 |     * status/priority: Lists of entities with specified status/priority values
107 |     * sequence: Preceding and following entities in research processes
108 | - Error information when operations fail
109 | 
110 | You should:
111 | - Start with broad queries ("graph", "search") to explore your research corpus
112 | - Use specific entity queries ("nodes", "project", "participant") for detailed information
113 | - Combine search and related queries to discover connections in your data
114 | - Generate codebooks and project overviews for documentation and reporting
115 | - Use transcript retrieval to access primary data when needed
116 | - Explore thematic structures through themes and related entity queries
117 | - Review memos to track your analytical process over time
118 | - Filter code and theme queries by project for more focused results
119 | - Use search with entity type filters to find specific types of research elements
120 | - Use status queries to identify all entities at a particular research stage
121 | - Use priority queries to focus on high-priority research tasks
122 | - Use sequence queries to understand process flows in your research methodology 
```

--------------------------------------------------------------------------------
/main/descriptions/project_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the project management knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire project management structure
  5 | - Searching for specific project entities across your initiatives
  6 | - Getting detailed information about particular projects or project elements
  7 | - Exploring task dependencies and their critical paths
  8 | - Analyzing team member assignments and workload
  9 | - Tracking milestone progress and completion status
 10 | - Examining project timelines and schedules
 11 | - Assessing resource allocation across projects
 12 | - Identifying and monitoring project risks
 13 | - Finding connections between related projects
 14 | - Reviewing decision logs and project governance
 15 | - Evaluating overall project health and status
 16 | - Filtering entities by status values (inactive, active, complete)
 17 | - Finding high-priority tasks and activities
 18 | - Analyzing sequential relationships between tasks
 19 | 
 20 | Key features:
 21 | - Offers specialized operations for querying different aspects of project management data
 22 | - Retrieves complete or filtered views of the project knowledge graph
 23 | - Provides flexible search capabilities across all project entities
 24 | - Supports detailed exploration of specific entities by name
 25 | - Generates comprehensive project overviews with related elements
 26 | - Maps task dependencies to identify critical paths
 27 | - Tracks team member assignments and responsibilities
 28 | - Monitors milestone progress with completion metrics
 29 | - Creates project timelines with key dates and dependencies
 30 | - Manages resource allocation across project activities
 31 | - Identifies and prioritizes project risks
 32 | - Finds relationships between projects for portfolio management
 33 | - Records and retrieves decision logs for governance
 34 | - Assesses project health with key performance indicators
 35 | - Filters entities by status via has_status relations
 36 | - Identifies high-priority items via has_priority relations
 37 | - Analyzes task sequencing through precedes relations
 38 | 
 39 | Parameters explained:
 40 | 1. type: The type of query operation to perform
 41 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "dependencies", "assignments", "milestones", "timeline", "resources", "risks", "related", "decisions", "health", "status", "priority", "sequence"
 42 |   - Determines how the params parameter is interpreted
 43 | 2. params: Operation-specific parameters (structure varies by type):
 44 |   - For "graph": No parameters needed (retrieves the full project knowledge graph)
 45 |   - For "search": Object containing:
 46 |     * query: Search string to find entities (supports entity type filters)
 47 |   - For "nodes": Object containing:
 48 |     * names: Array of entity names to retrieve
 49 |   - For "project": Object containing:
 50 |     * projectName: Name of the project to retrieve details for
 51 |   - For "dependencies": Object containing:
 52 |     * taskName: Name of the task to analyze dependencies for
 53 |     * depth: (Optional) How many levels of dependencies to retrieve (default: 2)
 54 |   - For "assignments": Object containing:
 55 |     * teamMemberName: Name of the team member to retrieve assignments for
 56 |   - For "milestones": Object containing:
 57 |     * projectName: Project name to retrieve milestones for
 58 |     * milestoneName: (Optional) Specific milestone to retrieve details for
 59 |   - For "timeline": Object containing:
 60 |     * projectName: Project name to generate timeline for
 61 |   - For "resources": Object containing:
 62 |     * projectName: Project name to analyze resource allocation for
 63 |     * resourceName: (Optional) Specific resource to analyze allocation for
 64 |   - For "risks": Object containing:
 65 |     * projectName: Project name to retrieve risks for
 66 |   - For "related": Object containing:
 67 |     * projectName: Project name to find related projects for
 68 |     * depth: (Optional) Depth of project relationships to explore (default: 1)
 69 |   - For "decisions": Object containing:
 70 |     * projectName: Project name to retrieve decision log for
 71 |   - For "health": Object containing:
 72 |     * projectName: Project name to assess health for
 73 |   - For "status": Object containing:
 74 |     * statusValue: The status value to filter by (e.g., "inactive", "active", "complete")
 75 |   - For "priority": Object containing:
 76 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 77 |   - For "sequence": Object containing:
 78 |     * taskName: Name of the task to analyze sequential relationships for
 79 | 
 80 | Operation details:
 81 | - graph: Returns the complete project knowledge graph with all entities and relationships
 82 | - search: Performs text-based search across entity names and observations
 83 | - nodes: Retrieves detailed information about specific entities by name
 84 | - project: Returns comprehensive project information including tasks, milestones, and team members
 85 | - dependencies: Maps task dependencies to identify critical paths and bottlenecks
 86 | - assignments: Lists all assignments for a specific team member with workload information
 87 | - milestones: Tracks milestone progress with completion status and metrics
 88 | - timeline: Generates a project timeline with key dates, dependencies, and current status
 89 | - resources: Analyzes resource allocation across project activities
 90 | - risks: Identifies and prioritizes project risks with mitigation strategies
 91 | - related: Finds connections between projects for portfolio management
 92 | - decisions: Retrieves decision log for project governance and audit
 93 | - health: Assesses project health with key performance indicators and metrics
 94 | - status: Retrieves all entities with a specific status value (inactive, active, complete)
 95 | - priority: Retrieves all entities with a specific priority value (high, low)
 96 | - sequence: Identifies sequential relationships for tasks, showing preceding and following tasks
 97 | 
 98 | Status and Priority Information:
 99 | - Status queries return entities organized by their current state in the project lifecycle
100 | - Priority queries help identify critical project tasks and elements
101 | - Status values include: inactive, active, complete
102 | - Priority values include: high, low
103 | - Status and priority are assigned through has_status and has_priority relations
104 | 
105 | Sequential Task Information:
106 | - Sequence queries identify tasks that come before or after in a project workflow
107 | - Sequential relationships help visualize the project workflow and dependencies
108 | - The sequence operation shows both incoming and outgoing precedes relations
109 | - Task sequences are critical for project planning and critical path identification
110 | 
111 | Return information:
112 | - success: Boolean indicating whether the operation succeeded
113 | - Additional fields depend on the operation type:
114 |   * graph: Complete knowledge graph
115 |   * results: For search operations
116 |   * nodes: For specific entity retrieval
117 |   * project/dependencies/assignments/etc.: For specialized views
118 |   * status/priority: Lists of entities with specified status/priority values
119 |   * sequence: Preceding and following tasks in project workflows
120 | 
121 | You should:
122 | - Start with broad queries ("graph", "search") to explore your project portfolio
123 | - Use specific entity queries ("nodes", "project") for detailed information
124 | - Map task dependencies to identify critical paths and bottlenecks
125 | - Track team member assignments to manage workload and availability
126 | - Monitor milestone progress to ensure project timeline adherence
127 | - Generate project timelines for planning and tracking purposes
128 | - Analyze resource allocation to optimize utilization
129 | - Identify and prioritize project risks for proactive management
130 | - Find relationships between projects for portfolio-level insights
131 | - Review decision logs for governance and accountability
132 | - Assess project health regularly with the health operation
133 | - Use status queries to filter entities by their current state
134 | - Use priority queries to focus on high-priority items
135 | - Use sequence queries to understand task workflows and dependencies
136 | - Combine multiple operations to build comprehensive project dashboards 
```

--------------------------------------------------------------------------------
/project/project_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the project management knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire project management structure
  5 | - Searching for specific project entities across your initiatives
  6 | - Getting detailed information about particular projects or project elements
  7 | - Exploring task dependencies and their critical paths
  8 | - Analyzing team member assignments and workload
  9 | - Tracking milestone progress and completion status
 10 | - Examining project timelines and schedules
 11 | - Assessing resource allocation across projects
 12 | - Identifying and monitoring project risks
 13 | - Finding connections between related projects
 14 | - Reviewing decision logs and project governance
 15 | - Evaluating overall project health and status
 16 | - Filtering entities by status values (inactive, active, complete)
 17 | - Finding high-priority tasks and activities
 18 | - Analyzing sequential relationships between tasks
 19 | 
 20 | Key features:
 21 | - Offers specialized operations for querying different aspects of project management data
 22 | - Retrieves complete or filtered views of the project knowledge graph
 23 | - Provides flexible search capabilities across all project entities
 24 | - Supports detailed exploration of specific entities by name
 25 | - Generates comprehensive project overviews with related elements
 26 | - Maps task dependencies to identify critical paths
 27 | - Tracks team member assignments and responsibilities
 28 | - Monitors milestone progress with completion metrics
 29 | - Creates project timelines with key dates and dependencies
 30 | - Manages resource allocation across project activities
 31 | - Identifies and prioritizes project risks
 32 | - Finds relationships between projects for portfolio management
 33 | - Records and retrieves decision logs for governance
 34 | - Assesses project health with key performance indicators
 35 | - Filters entities by status via has_status relations
 36 | - Identifies high-priority items via has_priority relations
 37 | - Analyzes task sequencing through precedes relations
 38 | 
 39 | Parameters explained:
 40 | 1. type: The type of query operation to perform
 41 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "dependencies", "assignments", "milestones", "timeline", "resources", "risks", "related", "decisions", "health", "status", "priority", "sequence"
 42 |   - Determines how the params parameter is interpreted
 43 | 2. params: Operation-specific parameters (structure varies by type):
 44 |   - For "graph": No parameters needed (retrieves the full project knowledge graph)
 45 |   - For "search": Object containing:
 46 |     * query: Search string to find entities (supports entity type filters)
 47 |   - For "nodes": Object containing:
 48 |     * names: Array of entity names to retrieve
 49 |   - For "project": Object containing:
 50 |     * projectName: Name of the project to retrieve details for
 51 |   - For "dependencies": Object containing:
 52 |     * taskName: Name of the task to analyze dependencies for
 53 |     * depth: (Optional) How many levels of dependencies to retrieve (default: 2)
 54 |   - For "assignments": Object containing:
 55 |     * teamMemberName: Name of the team member to retrieve assignments for
 56 |   - For "milestones": Object containing:
 57 |     * projectName: Project name to retrieve milestones for
 58 |     * milestoneName: (Optional) Specific milestone to retrieve details for
 59 |   - For "timeline": Object containing:
 60 |     * projectName: Project name to generate timeline for
 61 |   - For "resources": Object containing:
 62 |     * projectName: Project name to analyze resource allocation for
 63 |     * resourceName: (Optional) Specific resource to analyze allocation for
 64 |   - For "risks": Object containing:
 65 |     * projectName: Project name to retrieve risks for
 66 |   - For "related": Object containing:
 67 |     * projectName: Project name to find related projects for
 68 |     * depth: (Optional) Depth of project relationships to explore (default: 1)
 69 |   - For "decisions": Object containing:
 70 |     * projectName: Project name to retrieve decision log for
 71 |   - For "health": Object containing:
 72 |     * projectName: Project name to assess health for
 73 |   - For "status": Object containing:
 74 |     * statusValue: The status value to filter by (e.g., "inactive", "active", "complete")
 75 |   - For "priority": Object containing:
 76 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 77 |   - For "sequence": Object containing:
 78 |     * taskName: Name of the task to analyze sequential relationships for
 79 | 
 80 | Operation details:
 81 | - graph: Returns the complete project knowledge graph with all entities and relationships
 82 | - search: Performs text-based search across entity names and observations
 83 | - nodes: Retrieves detailed information about specific entities by name
 84 | - project: Returns comprehensive project information including tasks, milestones, and team members
 85 | - dependencies: Maps task dependencies to identify critical paths and bottlenecks
 86 | - assignments: Lists all assignments for a specific team member with workload information
 87 | - milestones: Tracks milestone progress with completion status and metrics
 88 | - timeline: Generates a project timeline with key dates, dependencies, and current status
 89 | - resources: Analyzes resource allocation across project activities
 90 | - risks: Identifies and prioritizes project risks with mitigation strategies
 91 | - related: Finds connections between projects for portfolio management
 92 | - decisions: Retrieves decision log for project governance and audit
 93 | - health: Assesses project health with key performance indicators and metrics
 94 | - status: Retrieves all entities with a specific status value (inactive, active, complete)
 95 | - priority: Retrieves all entities with a specific priority value (high, low)
 96 | - sequence: Identifies sequential relationships for tasks, showing preceding and following tasks
 97 | 
 98 | Status and Priority Information:
 99 | - Status queries return entities organized by their current state in the project lifecycle
100 | - Priority queries help identify critical project tasks and elements
101 | - Status values include: inactive, active, complete
102 | - Priority values include: high, low
103 | - Status and priority are assigned through has_status and has_priority relations
104 | 
105 | Sequential Task Information:
106 | - Sequence queries identify tasks that come before or after in a project workflow
107 | - Sequential relationships help visualize the project workflow and dependencies
108 | - The sequence operation shows both incoming and outgoing precedes relations
109 | - Task sequences are critical for project planning and critical path identification
110 | 
111 | Return information:
112 | - success: Boolean indicating whether the operation succeeded
113 | - Additional fields depend on the operation type:
114 |   * graph: Complete knowledge graph
115 |   * results: For search operations
116 |   * nodes: For specific entity retrieval
117 |   * project/dependencies/assignments/etc.: For specialized views
118 |   * status/priority: Lists of entities with specified status/priority values
119 |   * sequence: Preceding and following tasks in project workflows
120 | 
121 | You should:
122 | - Start with broad queries ("graph", "search") to explore your project portfolio
123 | - Use specific entity queries ("nodes", "project") for detailed information
124 | - Map task dependencies to identify critical paths and bottlenecks
125 | - Track team member assignments to manage workload and availability
126 | - Monitor milestone progress to ensure project timeline adherence
127 | - Generate project timelines for planning and tracking purposes
128 | - Analyze resource allocation to optimize utilization
129 | - Identify and prioritize project risks for proactive management
130 | - Find relationships between projects for portfolio-level insights
131 | - Review decision logs for governance and accountability
132 | - Assess project health regularly with the health operation
133 | - Use status queries to filter entities by their current state
134 | - Use priority queries to focus on high-priority items
135 | - Use sequence queries to understand task workflows and dependencies
136 | - Combine multiple operations to build comprehensive project dashboards 
```

--------------------------------------------------------------------------------
/main/descriptions/qualitativeresearch_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting qualitative research sessions, recording analysis progress, tracking coding activities, and creating a structured record of research evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a qualitative research analysis session
  5 | - Documenting interview data collection activities
  6 | - Recording newly created analytical memos
  7 | - Tracking coding activities and code applications
  8 | - Documenting emerging themes and theoretical constructs
  9 | - Updating overall project status and progress
 10 | - Creating a structured record of research activities
 11 | - Establishing a formal conclusion to a focused research period
 12 | - Building a historical record of project development
 13 | - Documenting observations and insights from a research session
 14 | - Updating status values for research activities and entities
 15 | - Assigning or modifying priority levels for research tasks
 16 | - Establishing or modifying sequential relationships between research processes
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for research session documentation
 20 | - Records interview data collection in the knowledge graph
 21 | - Captures newly created analytical memos
 22 | - Tracks coding activities across data sources
 23 | - Documents emerging themes and their connections to codes
 24 | - Updates project status information
 25 | - Maintains session continuity with unique session IDs
 26 | - Supports revision of previous stages when needed
 27 | - Offers a comprehensive assembly stage that consolidates all session information
 28 | - Organizes qualitative research activity into a coherent narrative
 29 | - Manages status progression of research activities
 30 | - Tracks priority assignments for research tasks
 31 | - Documents sequential relationships between research processes
 32 | 
 33 | The endsession tool uses a sequential, multi-stage approach with typically 8 stages:
 34 | 1. Summary Stage: Records basic session information
 35 | 2. Interview Data Stage: Documents new interviews conducted
 36 | 3. Memos Stage: Records new analytical memos created
 37 | 4. Coding Activity Stage: Documents code applications and coding work
 38 | 5. Themes Stage: Records emerging themes and theoretical insights
 39 | 6. Status Updates Stage: Records changes to entity status values
 40 | 7. Project Status Stage: Updates the overall project status
 41 | 8. Assembly Stage: Consolidates all information and finalizes the session record
 42 | 
 43 | Parameters explained:
 44 | 1. sessionId: Required - Unique identifier for the research session
 45 |   - Obtained from the startsession tool
 46 |   - Example: "qual_1234567890_abc123"
 47 | 2. stage: Required - Current stage of the endsession workflow
 48 |   - Accepts: "summary", "interviewData", "memos", "codingActivity", "themes", "statusUpdates", "projectStatus", or "assembly"
 49 |   - Each stage has specific data requirements and processing logic
 50 | 3. stageNumber: Required - The sequence number of the current stage
 51 |   - Starts at 1 and typically progresses through the stages
 52 |   - Used to track progress through the session documentation workflow
 53 | 4. totalStages: Required - Total number of stages planned for this workflow
 54 |   - Typically 8 for the complete workflow
 55 |   - Provides context for the progress within the overall process
 56 | 5. analysis: Optional - Text analysis or observations for the current stage
 57 |   - Descriptive text explaining the work done in this stage
 58 |   - Example: "Analyzed interview transcripts and identified recurring patterns"
 59 | 6. stageData: Optional - Stage-specific structured data
 60 |   - Structure varies by stage type:
 61 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 62 |     * interviewData: { interviews: [{ participant: "P001", notes: "Interview notes", date: "2023-04-15" }] }
 63 |     * memos: { memos: [{ topic: "Emerging patterns", content: "Detailed memo text" }] }
 64 |     * codingActivity: { codes: [{ code: "coping_strategy", dataItem: "Interview_P001", note: "Applied to discussion of stress management" }] }
 65 |     * themes: { themes: [{ name: "Social Support", codes: ["family_support", "peer_networks"], description: "The role of social connections in coping" }] }
 66 |     * statusUpdates: { statusUpdates: [{ entityName: "Interview_P003", newStatus: "transcribed", note: "Completed transcription" }, { entityName: "Code_Resilience", newStatus: "established", note: "Well-supported by data" }] }
 67 |     * projectStatus: { projectStatus: "data_analysis", projectObservation: "Making good progress on initial coding", priorityUpdates: [{ entityName: "Transcribe_P004", priority: "high", note: "Critical for thematic development" }], sequenceUpdates: [{ before: "Coding_Phase1", after: "Theme_Development", note: "Ready to move from coding to theme creation" }] }
 68 |     * assembly: No stageData needed - automatically assembled from previous stages
 69 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 70 |   - Boolean value (true/false)
 71 |   - Set to false on the final stage to complete the session
 72 | 8. isRevision: Optional - Whether this is revising a previous stage
 73 |   - Boolean value (true/false)
 74 |   - Default: false
 75 | 9. revisesStage: Optional - If revising, which stage number is being revised
 76 |   - Required when isRevision is true
 77 |   - Indicates which previous stage is being updated
 78 | 
 79 | Status and Priority Management:
 80 | - The statusUpdates stage allows for batch updates to entity status values
 81 | - Valid status values include: planning, data_collection, analysis, writing, complete, scheduled, conducted, transcribed, coded, analyzed, emerging, developing, established, preliminary, draft, final, active, in_progress
 82 | - Priority assignments (high, low) can be modified in the projectStatus stage
 83 | - Status changes are tracked to maintain a history of research progression
 84 | - Priority changes help reallocate focus as research needs evolve
 85 | 
 86 | Sequential Process Management:
 87 | - The projectStatus stage allows for defining or modifying sequential relationships
 88 | - The precedes relation is used to establish logical ordering between research activities
 89 | - Sequential updates help maintain a coherent research workflow
 90 | - Process sequences can be visualized through the loadcontext tool
 91 | 
 92 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool:
 93 | 1. Records the session completion in persistent storage
 94 | 2. Creates a formatted summary of all session information
 95 | 3. Updates the status, priority, and sequential relationships for relevant entities
 96 | 4. Preserves the record of research activities for future reference
 97 | 
 98 | Return information:
 99 | - JSON response with the following structure:
100 |   * success: Boolean indicating whether the operation succeeded
101 |   * stageCompleted: The stage that was just completed
102 |   * nextStageNeeded: Whether more stages are required
103 |   * stageResult: The processed result of the current stage
104 |   * endSessionArgs: (Only in assembly stage) Consolidated arguments for the session
105 |   * sessionRecorded: (Final stage only) Whether the session was recorded
106 |   * summaryMessage: (Final stage only) Formatted summary of all recorded information
107 |   * error: (Only on failure) Error message describing the issue
108 | 
109 | You should:
110 | - Complete all stages in order for comprehensive session documentation
111 | - Provide specific details in each stage for accurate research documentation
112 | - Document interview data with participant identifiers and key notes
113 | - Create descriptive titles for analytical memos
114 | - Be specific about which codes were applied to which data items
115 | - Connect emerging themes to their supporting codes
116 | - Update status values to reflect progress in research activities
117 | - Assign appropriate priorities to focus attention on critical tasks
118 | - Define logical sequences between research processes with precedes relations
119 | - Include relevant observations for project status updates
120 | - If making a revision, specify which stage is being revised
121 | - Only mark nextStageNeeded as false on the final assembly stage
122 | - Review the final summary message to confirm all session details were recorded properly
123 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/qualitativeresearch/qualitativeresearch_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting qualitative research sessions, recording analysis progress, tracking coding activities, and creating a structured record of research evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a qualitative research analysis session
  5 | - Documenting interview data collection activities
  6 | - Recording newly created analytical memos
  7 | - Tracking coding activities and code applications
  8 | - Documenting emerging themes and theoretical constructs
  9 | - Updating overall project status and progress
 10 | - Creating a structured record of research activities
 11 | - Establishing a formal conclusion to a focused research period
 12 | - Building a historical record of project development
 13 | - Documenting observations and insights from a research session
 14 | - Updating status values for research activities and entities
 15 | - Assigning or modifying priority levels for research tasks
 16 | - Establishing or modifying sequential relationships between research processes
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for research session documentation
 20 | - Records interview data collection in the knowledge graph
 21 | - Captures newly created analytical memos
 22 | - Tracks coding activities across data sources
 23 | - Documents emerging themes and their connections to codes
 24 | - Updates project status information
 25 | - Maintains session continuity with unique session IDs
 26 | - Supports revision of previous stages when needed
 27 | - Offers a comprehensive assembly stage that consolidates all session information
 28 | - Organizes qualitative research activity into a coherent narrative
 29 | - Manages status progression of research activities
 30 | - Tracks priority assignments for research tasks
 31 | - Documents sequential relationships between research processes
 32 | 
 33 | The endsession tool uses a sequential, multi-stage approach with typically 8 stages:
 34 | 1. Summary Stage: Records basic session information
 35 | 2. Interview Data Stage: Documents new interviews conducted
 36 | 3. Memos Stage: Records new analytical memos created
 37 | 4. Coding Activity Stage: Documents code applications and coding work
 38 | 5. Themes Stage: Records emerging themes and theoretical insights
 39 | 6. Status Updates Stage: Records changes to entity status values
 40 | 7. Project Status Stage: Updates the overall project status
 41 | 8. Assembly Stage: Consolidates all information and finalizes the session record
 42 | 
 43 | Parameters explained:
 44 | 1. sessionId: Required - Unique identifier for the research session
 45 |   - Obtained from the startsession tool
 46 |   - Example: "qual_1234567890_abc123"
 47 | 2. stage: Required - Current stage of the endsession workflow
 48 |   - Accepts: "summary", "interviewData", "memos", "codingActivity", "themes", "statusUpdates", "projectStatus", or "assembly"
 49 |   - Each stage has specific data requirements and processing logic
 50 | 3. stageNumber: Required - The sequence number of the current stage
 51 |   - Starts at 1 and typically progresses through the stages
 52 |   - Used to track progress through the session documentation workflow
 53 | 4. totalStages: Required - Total number of stages planned for this workflow
 54 |   - Typically 8 for the complete workflow
 55 |   - Provides context for the progress within the overall process
 56 | 5. analysis: Optional - Text analysis or observations for the current stage
 57 |   - Descriptive text explaining the work done in this stage
 58 |   - Example: "Analyzed interview transcripts and identified recurring patterns"
 59 | 6. stageData: Optional - Stage-specific structured data
 60 |   - Structure varies by stage type:
 61 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 62 |     * interviewData: { interviews: [{ participant: "P001", notes: "Interview notes", date: "2023-04-15" }] }
 63 |     * memos: { memos: [{ topic: "Emerging patterns", content: "Detailed memo text" }] }
 64 |     * codingActivity: { codes: [{ code: "coping_strategy", dataItem: "Interview_P001", note: "Applied to discussion of stress management" }] }
 65 |     * themes: { themes: [{ name: "Social Support", codes: ["family_support", "peer_networks"], description: "The role of social connections in coping" }] }
 66 |     * statusUpdates: { statusUpdates: [{ entityName: "Interview_P003", newStatus: "transcribed", note: "Completed transcription" }, { entityName: "Code_Resilience", newStatus: "established", note: "Well-supported by data" }] }
 67 |     * projectStatus: { projectStatus: "data_analysis", projectObservation: "Making good progress on initial coding", priorityUpdates: [{ entityName: "Transcribe_P004", priority: "high", note: "Critical for thematic development" }], sequenceUpdates: [{ before: "Coding_Phase1", after: "Theme_Development", note: "Ready to move from coding to theme creation" }] }
 68 |     * assembly: No stageData needed - automatically assembled from previous stages
 69 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 70 |   - Boolean value (true/false)
 71 |   - Set to false on the final stage to complete the session
 72 | 8. isRevision: Optional - Whether this is revising a previous stage
 73 |   - Boolean value (true/false)
 74 |   - Default: false
 75 | 9. revisesStage: Optional - If revising, which stage number is being revised
 76 |   - Required when isRevision is true
 77 |   - Indicates which previous stage is being updated
 78 | 
 79 | Status and Priority Management:
 80 | - The statusUpdates stage allows for batch updates to entity status values
 81 | - Valid status values include: planning, data_collection, analysis, writing, complete, scheduled, conducted, transcribed, coded, analyzed, emerging, developing, established, preliminary, draft, final, active, in_progress
 82 | - Priority assignments (high, low) can be modified in the projectStatus stage
 83 | - Status changes are tracked to maintain a history of research progression
 84 | - Priority changes help reallocate focus as research needs evolve
 85 | 
 86 | Sequential Process Management:
 87 | - The projectStatus stage allows for defining or modifying sequential relationships
 88 | - The precedes relation is used to establish logical ordering between research activities
 89 | - Sequential updates help maintain a coherent research workflow
 90 | - Process sequences can be visualized through the loadcontext tool
 91 | 
 92 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool:
 93 | 1. Records the session completion in persistent storage
 94 | 2. Creates a formatted summary of all session information
 95 | 3. Updates the status, priority, and sequential relationships for relevant entities
 96 | 4. Preserves the record of research activities for future reference
 97 | 
 98 | Return information:
 99 | - JSON response with the following structure:
100 |   * success: Boolean indicating whether the operation succeeded
101 |   * stageCompleted: The stage that was just completed
102 |   * nextStageNeeded: Whether more stages are required
103 |   * stageResult: The processed result of the current stage
104 |   * endSessionArgs: (Only in assembly stage) Consolidated arguments for the session
105 |   * sessionRecorded: (Final stage only) Whether the session was recorded
106 |   * summaryMessage: (Final stage only) Formatted summary of all recorded information
107 |   * error: (Only on failure) Error message describing the issue
108 | 
109 | You should:
110 | - Complete all stages in order for comprehensive session documentation
111 | - Provide specific details in each stage for accurate research documentation
112 | - Document interview data with participant identifiers and key notes
113 | - Create descriptive titles for analytical memos
114 | - Be specific about which codes were applied to which data items
115 | - Connect emerging themes to their supporting codes
116 | - Update status values to reflect progress in research activities
117 | - Assign appropriate priorities to focus attention on critical tasks
118 | - Define logical sequences between research processes with precedes relations
119 | - Include relevant observations for project status updates
120 | - If making a revision, specify which stage is being revised
121 | - Only mark nextStageNeeded as false on the final assembly stage
122 | - Review the final summary message to confirm all session details were recorded properly
123 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/main/descriptions/quantitativeresearch_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the quantitative research knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire research knowledge structure
  5 | - Searching for specific research entities across your quantitative data projects
  6 | - Getting detailed information about particular research projects, datasets, or statistical elements
  7 | - Exploring relationships between variables and their statistical properties
  8 | - Analyzing hypothesis test results and their implications
  9 | - Retrieving statistical model performance metrics
 10 | - Accessing visualization galleries for specific projects or datasets
 11 | - Examining variable distributions and their statistical properties
 12 | - Finding connections between different aspects of your research
 13 | - Creating statistical reports or summaries from your data
 14 | - Exploring the relationships between research questions and findings
 15 | - Identifying entities by status to track research progress
 16 | - Filtering tasks by priority to manage research workflow
 17 | - Analyzing sequential relationships between research processes
 18 | 
 19 | Key features:
 20 | - Offers specialized operations for querying different aspects of quantitative research data
 21 | - Retrieves complete or filtered views of the research knowledge graph
 22 | - Provides flexible search capabilities across all research entities
 23 | - Supports detailed exploration of specific entities by name
 24 | - Generates specialized views for projects, datasets, hypotheses, and variables
 25 | - Retrieves statistical results, visualizations, and model performance metrics
 26 | - Provides detailed variable distribution analysis
 27 | - Identifies related entities to explore connections within your research
 28 | - Returns consistently structured JSON responses for easy processing
 29 | - Facilitates depth and breadth exploration of quantitative data
 30 | - Supports status-based filtering of research entities
 31 | - Enables priority-based task management
 32 | - Provides sequential process analysis capabilities
 33 | 
 34 | Parameters explained:
 35 | 1. type: The type of query operation to perform
 36 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "dataset", "hypothesis", "variables", "statistics", "visualizations", "model", "question", "distribution", "related", "status", "priority", "sequence"
 37 |   - Determines how the params parameter is interpreted
 38 | 2. params: Operation-specific parameters (structure varies by type):
 39 |   - For "graph": No parameters needed (retrieves the full research knowledge graph)
 40 |   - For "search": Object containing:
 41 |     * query: Search string to find entities (supports entity type filters)
 42 |   - For "nodes": Object containing:
 43 |     * names: Array of entity names to retrieve
 44 |   - For "project": Object containing:
 45 |     * projectName: Name of the project to retrieve details for
 46 |   - For "dataset": Object containing:
 47 |     * datasetName: Name of the dataset to retrieve analysis for
 48 |   - For "hypothesis": Object containing:
 49 |     * projectName: Project name to filter hypotheses by
 50 |     * hypothesisName: (Optional) Specific hypothesis to retrieve tests for
 51 |   - For "variables": Object containing:
 52 |     * variableName: Name of the variable to retrieve relationship information for
 53 |   - For "statistics": Object containing:
 54 |     * projectName: Project name to retrieve statistical results for
 55 |     * testType: (Optional) Type of statistical test to filter by
 56 |   - For "visualizations": Object containing:
 57 |     * projectName: Project name to retrieve visualizations for
 58 |     * datasetName: (Optional) Dataset name to filter visualizations by
 59 |   - For "model": Object containing:
 60 |     * modelName: Name of the model to retrieve performance metrics for
 61 |   - For "question": Object containing:
 62 |     * questionName: Name of the research question to retrieve results for
 63 |   - For "distribution": Object containing:
 64 |     * variableName: Name of the variable to analyze distribution of
 65 |     * datasetName: (Optional) Dataset name to contextualize the variable
 66 |   - For "related": Object containing:
 67 |     * entityName: Name of the entity to find related entities for
 68 |   - For "status": Object containing:
 69 |     * statusValue: The status value to filter by (e.g., "active", "completed", "pending", "abandoned")
 70 |   - For "priority": Object containing:
 71 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 72 |   - For "sequence": Object containing:
 73 |     * entityName: Name of the entity to find sequential relationships for
 74 | 
 75 | Operation details:
 76 | - graph: Returns the complete research knowledge graph with all entities and relationships
 77 | - search: Performs text-based search across entity names and observations
 78 | - nodes: Retrieves detailed information about specific entities by name
 79 | - project: Returns comprehensive project information including datasets, hypotheses, tests, and findings
 80 | - dataset: Provides detailed dataset analysis with variables, descriptive statistics, and correlations
 81 | - hypothesis: Retrieves hypothesis tests and their results for a project or specific hypothesis
 82 | - variables: Examines relationships between a variable and other variables (correlations, dependencies)
 83 | - statistics: Collects statistical test results for a project, optionally filtered by test type
 84 | - visualizations: Returns visualization metadata and descriptions for a project or dataset
 85 | - model: Provides detailed model performance metrics, parameters, and validation results
 86 | - question: Retrieves research question details, related hypotheses, and supporting findings
 87 | - distribution: Analyzes the statistical distribution of a variable with descriptive stats and normality tests
 88 | - related: Identifies all entities directly connected to a specific entity
 89 | - status: Retrieves all entities with a specific status value
 90 | - priority: Retrieves all entities with a specific priority value
 91 | - sequence: Identifies sequential relationships for a specific entity showing preceding and following entities
 92 | 
 93 | Status and Priority Information:
 94 | - Status queries return entities organized by their current research stage
 95 | - Priority queries help identify critical research tasks and elements
 96 | - Status values include: active, completed, pending, abandoned
 97 | - Priority values include: high, low
 98 | - Status and priority are assigned through has_status and has_priority relations
 99 | 
100 | Sequential Process Information:
101 | - Sequence queries identify entities that come before or after in a research process
102 | - Sequential relationships help visualize the research workflow and methodology
103 | - The sequence operation shows both incoming and outgoing precedes relations
104 | - Process sequences are essential for understanding multi-step analytical procedures
105 | 
106 | Return information:
107 | - success: Boolean indicating whether the operation succeeded
108 | - Additional fields depend on the operation type:
109 |   * graph: Complete knowledge graph
110 |   * results: For search operations
111 |   * nodes: For specific entity retrieval
112 |   * project/dataset/hypothesis/etc.: For specialized views
113 |   * status/priority: Lists of entities with specified status/priority values
114 |   * sequence: Preceding and following entities in research processes
115 | 
116 | You should:
117 | - Start with broad queries ("graph", "search") to explore your research corpus
118 | - Use specific entity queries ("nodes", "project", "dataset") for detailed information
119 | - Examine variable relationships and distributions to understand your data
120 | - Review hypothesis tests and statistical results to evaluate evidence
121 | - Explore model performance metrics to assess predictive accuracy
122 | - Use visualization galleries to communicate research findings
123 | - Examine research questions and their supporting evidence
124 | - Use status queries to identify all entities at a particular research stage
125 | - Use priority queries to focus on high-priority research tasks
126 | - Use sequence queries to understand process flows in your research methodology
127 | - Combine multiple operations to build a comprehensive understanding of your research
128 | - Use the related operation to discover connections between entities
129 | - Apply search filters to find specific types of research elements 
```

--------------------------------------------------------------------------------
/quantitativeresearch/quantitativeresearch_advancedcontext.txt:
--------------------------------------------------------------------------------

```
  1 | A sophisticated query tool for exploring, analyzing, and retrieving complex information from the quantitative research knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | - Retrieving a comprehensive view of your entire research knowledge structure
  5 | - Searching for specific research entities across your quantitative data projects
  6 | - Getting detailed information about particular research projects, datasets, or statistical elements
  7 | - Exploring relationships between variables and their statistical properties
  8 | - Analyzing hypothesis test results and their implications
  9 | - Retrieving statistical model performance metrics
 10 | - Accessing visualization galleries for specific projects or datasets
 11 | - Examining variable distributions and their statistical properties
 12 | - Finding connections between different aspects of your research
 13 | - Creating statistical reports or summaries from your data
 14 | - Exploring the relationships between research questions and findings
 15 | - Identifying entities by status to track research progress
 16 | - Filtering tasks by priority to manage research workflow
 17 | - Analyzing sequential relationships between research processes
 18 | 
 19 | Key features:
 20 | - Offers specialized operations for querying different aspects of quantitative research data
 21 | - Retrieves complete or filtered views of the research knowledge graph
 22 | - Provides flexible search capabilities across all research entities
 23 | - Supports detailed exploration of specific entities by name
 24 | - Generates specialized views for projects, datasets, hypotheses, and variables
 25 | - Retrieves statistical results, visualizations, and model performance metrics
 26 | - Provides detailed variable distribution analysis
 27 | - Identifies related entities to explore connections within your research
 28 | - Returns consistently structured JSON responses for easy processing
 29 | - Facilitates depth and breadth exploration of quantitative data
 30 | - Supports status-based filtering of research entities
 31 | - Enables priority-based task management
 32 | - Provides sequential process analysis capabilities
 33 | 
 34 | Parameters explained:
 35 | 1. type: The type of query operation to perform
 36 |   - Accepts one of the specialized operations: "graph", "search", "nodes", "project", "dataset", "hypothesis", "variables", "statistics", "visualizations", "model", "question", "distribution", "related", "status", "priority", "sequence"
 37 |   - Determines how the params parameter is interpreted
 38 | 2. params: Operation-specific parameters (structure varies by type):
 39 |   - For "graph": No parameters needed (retrieves the full research knowledge graph)
 40 |   - For "search": Object containing:
 41 |     * query: Search string to find entities (supports entity type filters)
 42 |   - For "nodes": Object containing:
 43 |     * names: Array of entity names to retrieve
 44 |   - For "project": Object containing:
 45 |     * projectName: Name of the project to retrieve details for
 46 |   - For "dataset": Object containing:
 47 |     * datasetName: Name of the dataset to retrieve analysis for
 48 |   - For "hypothesis": Object containing:
 49 |     * projectName: Project name to filter hypotheses by
 50 |     * hypothesisName: (Optional) Specific hypothesis to retrieve tests for
 51 |   - For "variables": Object containing:
 52 |     * variableName: Name of the variable to retrieve relationship information for
 53 |   - For "statistics": Object containing:
 54 |     * projectName: Project name to retrieve statistical results for
 55 |     * testType: (Optional) Type of statistical test to filter by
 56 |   - For "visualizations": Object containing:
 57 |     * projectName: Project name to retrieve visualizations for
 58 |     * datasetName: (Optional) Dataset name to filter visualizations by
 59 |   - For "model": Object containing:
 60 |     * modelName: Name of the model to retrieve performance metrics for
 61 |   - For "question": Object containing:
 62 |     * questionName: Name of the research question to retrieve results for
 63 |   - For "distribution": Object containing:
 64 |     * variableName: Name of the variable to analyze distribution of
 65 |     * datasetName: (Optional) Dataset name to contextualize the variable
 66 |   - For "related": Object containing:
 67 |     * entityName: Name of the entity to find related entities for
 68 |   - For "status": Object containing:
 69 |     * statusValue: The status value to filter by (e.g., "active", "completed", "pending", "abandoned")
 70 |   - For "priority": Object containing:
 71 |     * priorityValue: The priority value to filter by (e.g., "high", "low")
 72 |   - For "sequence": Object containing:
 73 |     * entityName: Name of the entity to find sequential relationships for
 74 | 
 75 | Operation details:
 76 | - graph: Returns the complete research knowledge graph with all entities and relationships
 77 | - search: Performs text-based search across entity names and observations
 78 | - nodes: Retrieves detailed information about specific entities by name
 79 | - project: Returns comprehensive project information including datasets, hypotheses, tests, and findings
 80 | - dataset: Provides detailed dataset analysis with variables, descriptive statistics, and correlations
 81 | - hypothesis: Retrieves hypothesis tests and their results for a project or specific hypothesis
 82 | - variables: Examines relationships between a variable and other variables (correlations, dependencies)
 83 | - statistics: Collects statistical test results for a project, optionally filtered by test type
 84 | - visualizations: Returns visualization metadata and descriptions for a project or dataset
 85 | - model: Provides detailed model performance metrics, parameters, and validation results
 86 | - question: Retrieves research question details, related hypotheses, and supporting findings
 87 | - distribution: Analyzes the statistical distribution of a variable with descriptive stats and normality tests
 88 | - related: Identifies all entities directly connected to a specific entity
 89 | - status: Retrieves all entities with a specific status value
 90 | - priority: Retrieves all entities with a specific priority value
 91 | - sequence: Identifies sequential relationships for a specific entity showing preceding and following entities
 92 | 
 93 | Status and Priority Information:
 94 | - Status queries return entities organized by their current research stage
 95 | - Priority queries help identify critical research tasks and elements
 96 | - Status values include: active, completed, pending, abandoned
 97 | - Priority values include: high, low
 98 | - Status and priority are assigned through has_status and has_priority relations
 99 | 
100 | Sequential Process Information:
101 | - Sequence queries identify entities that come before or after in a research process
102 | - Sequential relationships help visualize the research workflow and methodology
103 | - The sequence operation shows both incoming and outgoing precedes relations
104 | - Process sequences are essential for understanding multi-step analytical procedures
105 | 
106 | Return information:
107 | - success: Boolean indicating whether the operation succeeded
108 | - Additional fields depend on the operation type:
109 |   * graph: Complete knowledge graph
110 |   * results: For search operations
111 |   * nodes: For specific entity retrieval
112 |   * project/dataset/hypothesis/etc.: For specialized views
113 |   * status/priority: Lists of entities with specified status/priority values
114 |   * sequence: Preceding and following entities in research processes
115 | 
116 | You should:
117 | - Start with broad queries ("graph", "search") to explore your research corpus
118 | - Use specific entity queries ("nodes", "project", "dataset") for detailed information
119 | - Examine variable relationships and distributions to understand your data
120 | - Review hypothesis tests and statistical results to evaluate evidence
121 | - Explore model performance metrics to assess predictive accuracy
122 | - Use visualization galleries to communicate research findings
123 | - Examine research questions and their supporting evidence
124 | - Use status queries to identify all entities at a particular research stage
125 | - Use priority queries to focus on high-priority research tasks
126 | - Use sequence queries to understand process flows in your research methodology
127 | - Combine multiple operations to build a comprehensive understanding of your research
128 | - Use the related operation to discover connections between entities
129 | - Apply search filters to find specific types of research elements 
```

--------------------------------------------------------------------------------
/main/descriptions/common_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting domain-specific sessions, recording progress, tracking updates, and creating a structured record of work in the knowledge graph.
  2 | 
  3 | When to use this tool:
  4 | Only use this tool when the user explicitly requests it or provides explicit approval.
  5 | 
  6 | Key features:
  7 | - Provides a structured, multi-stage workflow for session documentation
  8 | - Records accomplishments/learnings in the knowledge graph
  9 | - Updates status of tracked elements based on progress
 10 | - Creates connections between related entities
 11 | - Updates overall project/course/research status and metadata
 12 | - Creates new elements for future work
 13 | - Supports revision of previous stages when needed
 14 | - Offers a comprehensive assembly stage that consolidates all session information
 15 | - Organizes activity into a coherent history
 16 | 
 17 | The endsession tool uses a sequential, multi-stage approach with typical stages varying by domain:
 18 | - Developer (6 stages): Summary, Achievements, Task Updates, New Tasks, Project Status, Assembly
 19 | - Student (6 stages): Summary, Concepts Learned, Assignment Updates, New Concepts, Course Status, Assembly
 20 | - Qualitative Research (7 stages): Summary, Interview Data, Memos, Coding Activity, Themes, Project Status, Assembly
 21 | - Quantitative Research (8 stages): Summary, Dataset Updates, New Analyses, New Visualizations, Hypothesis Results, Model Updates, Project Status, Assembly
 22 | - Project Management (7 stages): Summary, Achievements, Task Updates, New Tasks, Project Status, Risk Updates, Assembly
 23 | 
 24 | Parameters explained:
 25 | 1. sessionId: Required - Unique identifier for the session
 26 |   - Obtained from the startsession tool
 27 |   - Format varies by domain (dev_timestamp_randomstring, stu_timestamp_randomstring, etc.)
 28 | 2. stage: Required - Current stage of the endsession workflow
 29 |   - Accepts domain-specific stage values
 30 |   - Each stage has specific data requirements and processing logic
 31 | 3. stageNumber: Required - The sequence number of the current stage
 32 |   - Starts at 1 and progresses through domain-specific number of stages
 33 |   - Used to track progress through the session documentation workflow
 34 | 4. totalStages: Required - Total number of stages planned for this workflow
 35 |   - Varies by domain (typically 6-8 stages)
 36 |   - Provides context for the progress within the overall process
 37 | 5. analysis: Optional - Text analysis or observations for the current stage
 38 |   - Descriptive text explaining the work done in this stage
 39 | 6. stageData: Optional - Stage-specific structured data
 40 |   - Structure varies by stage type and domain:
 41 |     * Developer:
 42 |       - summary: { summary: "Session summary text", duration: "2 hours", focus: "ProjectName" }
 43 |       - achievements: { achievements: ["Implemented feature X", "Fixed bug Y", "Refactored component Z"] }
 44 |       - taskUpdates: { taskUpdates: [{ name: "Task1", status: "completed" }, { name: "Task2", status: "in_progress" }] }
 45 |       - newTasks: { newTasks: [{ name: "NewTask1", description: "Implement feature A", priority: "high" }] }
 46 |       - projectStatus: { projectName: "ProjectName", projectStatus: "in_progress", projectObservation: "Making good progress" }
 47 |     * Student:
 48 |       - summary: { summary: "Session summary text", duration: "2 hours", course: "CourseName" }
 49 |       - conceptsLearned: { concepts: ["Concept A", "Concept B", "Concept C"] }
 50 |       - assignmentUpdates: { updates: [{ name: "Assignment1", status: "completed" }, { name: "Assignment2", status: "in_progress" }] }
 51 |       - newConcepts: { concepts: [{ name: "NewConcept1", description: "Definition of the concept" }] }
 52 |       - courseStatus: { courseStatus: "in_progress", courseObservation: "Making good progress" }
 53 |     * Qualitative Research:
 54 |       - summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 55 |       - interviewData: { interviews: [{ participant: "P001", notes: "Interview notes", date: "2023-04-15" }] }
 56 |       - memos: { memos: [{ topic: "Emerging patterns", content: "Detailed memo text" }] }
 57 |       - codingActivity: { codes: [{ code: "coping_strategy", dataItem: "Interview_P001", note: "Applied to discussion of stress management" }] }
 58 |       - themes: { themes: [{ name: "Social Support", codes: ["family_support", "peer_networks"], description: "The role of social connections in coping" }] }
 59 |       - projectStatus: { projectStatus: "data_analysis", projectObservation: "Making good progress on initial coding" }
 60 |     * Quantitative Research:
 61 |       - summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 62 |       - datasetUpdates: { datasets: [{ name: "Dataset1", size: "500 rows", variables: "10", status: "cleaned", description: "Dataset description" }] }
 63 |       - newAnalyses: { analyses: [{ name: "Analysis1", type: "regression", result: "p<0.05", pValue: "0.03", variables: ["var1", "var2"] }] }
 64 |       - newVisualizations: { visualizations: [{ name: "Viz1", type: "scatter", description: "Correlation visualization", datasetName: "Dataset1" }] }
 65 |       - hypothesisResults: { hypotheses: [{ name: "H1", status: "confirmed", evidence: "Statistical significance in regression model", pValue: "0.02" }] }
 66 |       - modelUpdates: { models: [{ name: "Model1", type: "regression", performance: "R²=0.85", variables: ["var1", "var2"] }] }
 67 |       - projectStatus: { projectStatus: "in_progress", projectObservation: "Data analysis phase complete" }
 68 |     * Project Management:
 69 |       - summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 70 |       - achievements: { achievements: ["Decision 1", "Accomplishment 2"] }
 71 |       - taskUpdates: { updates: [{ name: "Task1", status: "in_progress", progress: "50%" }] }
 72 |       - newTasks: { tasks: [{ name: "New Task", description: "Details", priority: "high" }] }
 73 |       - projectStatus: { projectStatus: "in_progress", projectObservation: "Good progress" }
 74 |       - riskUpdates: { risks: [{ name: "Risk1", status: "mitigated", impact: "medium", probability: "low" }] }
 75 |     * All domains:
 76 |       - assembly: No stageData needed - automatically assembled from previous stages
 77 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 78 |   - Boolean value (true/false)
 79 |   - Set to false on the final stage to complete the session
 80 | 8. isRevision: Optional - Whether this is revising a previous stage
 81 |   - Boolean value (true/false)
 82 |   - Default: false
 83 | 9. revisesStage: Optional - If revising, which stage number is being revised
 84 |   - Required when isRevision is true
 85 |   - Indicates which previous stage is being updated
 86 | 
 87 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool performs domain-specific updates to the knowledge graph:
 88 | - Developer: Achievement entities, task status updates, project status updates, new task creation
 89 | - Student: Concept entities, assignment status updates, course status updates, new concept creation
 90 | - Qualitative Research: Interview records, memo creation, coding and theme organization, project status updates
 91 | - Quantitative Research: Dataset updates, statistical analyses, visualizations, hypothesis results, model updates, project status
 92 | - Project Management: Achievement entities, task status updates, project status updates, new task creation, risk updates
 93 | 
 94 | Return information:
 95 | - JSON response with the following structure:
 96 |   * success: Boolean indicating whether the operation succeeded
 97 |   * stageCompleted: The stage that was just completed
 98 |   * nextStageNeeded: Whether more stages are required
 99 |   * stageResult: The processed result of the current stage
100 |   * endSessionArgs: (Only in assembly stage) Consolidated arguments for the session
101 |   * sessionRecorded: (Final stage only) Whether the session was recorded
102 |   * summaryMessage: (Final stage only) Formatted summary of all recorded information
103 |   * error: (Only on failure) Error message describing the issue
104 | 
105 | You should:
106 | - Complete all stages in order for comprehensive session documentation
107 | - Provide specific details in each stage for accurate knowledge graph updates
108 | - Be precise about names of entities to ensure they match existing entities
109 | - Use clear, descriptive names for any new entities
110 | - Include relevant observations for status updates
111 | - If making a revision, specify which stage is being revised
112 | - Only mark nextStageNeeded as false on the final assembly stage
113 | - Review the final summary message to confirm all session details were recorded properly
114 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/main/descriptions/quantitativeresearch_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting quantitative research sessions, recording statistical analyses, tracking dataset updates, and creating a structured record of research evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a quantitative research analysis session
  5 | - Documenting updates to datasets and variables
  6 | - Recording new statistical analyses and test results
  7 | - Tracking creation of data visualizations
  8 | - Documenting hypothesis test results and conclusions
  9 | - Updating statistical model performance information
 10 | - Creating a structured record of research activities
 11 | - Establishing a formal conclusion to a focused research period
 12 | - Building a historical record of project development
 13 | - Documenting observations and insights from statistical analysis
 14 | - Updating status values for research activities and entities
 15 | - Assigning or modifying priority levels for research tasks
 16 | - Establishing or modifying sequential relationships between research processes
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for research session documentation
 20 | - Records dataset updates in the knowledge graph
 21 | - Captures new statistical analyses and their results
 22 | - Tracks creation of data visualizations and their purposes
 23 | - Documents hypothesis test outcomes with statistical significance
 24 | - Updates statistical model performance metrics
 25 | - Updates project status information
 26 | - Maintains session continuity with unique session IDs
 27 | - Supports revision of previous stages when needed
 28 | - Offers a comprehensive assembly stage that consolidates all session information
 29 | - Manages status progression of research activities
 30 | - Tracks priority assignments for research tasks
 31 | - Documents sequential relationships between research processes
 32 | 
 33 | The endsession tool uses a sequential, multi-stage approach with 9 typical stages:
 34 | 1. Summary Stage: Records basic session information
 35 | 2. Dataset Updates Stage: Documents changes to datasets
 36 | 3. New Analyses Stage: Records new statistical tests performed
 37 | 4. New Visualizations Stage: Documents visualizations created
 38 | 5. Hypothesis Results Stage: Records outcomes of hypothesis tests
 39 | 6. Model Updates Stage: Documents changes to statistical models
 40 | 7. Status Updates Stage: Records changes to entity status values
 41 | 8. Project Status Stage: Updates the overall project status
 42 | 9. Assembly Stage: Consolidates all information and finalizes the session record
 43 | 
 44 | Parameters explained:
 45 | 1. sessionId: Required - Unique identifier for the research session
 46 |   - Obtained from the startsession tool
 47 |   - Example: "quant_1234567890_abc123"
 48 | 2. stage: Required - Current stage of the endsession workflow
 49 |   - Accepts: "summary", "datasetUpdates", "newAnalyses", "newVisualizations", "hypothesisResults", "modelUpdates", "statusUpdates", "projectStatus", or "assembly"
 50 |   - Each stage has specific data requirements and processing logic
 51 | 3. stageNumber: Required - The sequence number of the current stage
 52 |   - Starts at 1 and typically progresses through the stages
 53 |   - Used to track progress through the session documentation workflow
 54 | 4. totalStages: Required - Total number of stages planned for this workflow
 55 |   - Typically 9 for the complete workflow
 56 |   - Provides context for the progress within the overall process
 57 | 5. analysis: Optional - Text analysis or observations for the current stage
 58 |   - Descriptive text explaining the work done in this stage
 59 |   - Example: "Analyzed multiple regression results and identified significant predictors"
 60 | 6. stageData: Optional - Stage-specific structured data
 61 |   - Structure varies by stage type:
 62 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 63 |     * datasetUpdates: { datasets: [{ name: "Dataset1", size: "500 rows", variables: "10", status: "active", description: "Dataset description" }] }
 64 |     * newAnalyses: { analyses: [{ name: "Analysis1", type: "regression", result: "p<0.05", pValue: "0.03", variables: ["var1", "var2"] }] }
 65 |     * newVisualizations: { visualizations: [{ name: "Viz1", type: "scatter", description: "Correlation visualization", datasetName: "Dataset1" }] }
 66 |     * hypothesisResults: { hypotheses: [{ name: "H1", status: "completed", evidence: "Statistical significance in regression model", pValue: "0.02" }] }
 67 |     * modelUpdates: { models: [{ name: "Model1", type: "regression", performance: "R²=0.85", variables: ["var1", "var2"] }] }
 68 |     * statusUpdates: { statusUpdates: [{ entityName: "Dataset1", newStatus: "completed", note: "Data cleaning and validation complete" }, { entityName: "Model2", newStatus: "active", note: "Model training in progress" }] }
 69 |     * projectStatus: { projectStatus: "active", projectObservation: "Data analysis phase complete", priorityUpdates: [{ entityName: "AnalysisTask1", priority: "high", note: "Critical for upcoming publication" }], sequenceUpdates: [{ before: "DataCleaning", after: "ModelTraining", note: "Reorganized analysis workflow" }] }
 70 |     * assembly: No stageData needed - automatically assembled from previous stages
 71 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 72 |   - Boolean value (true/false)
 73 |   - Set to false on the final stage to complete the session
 74 | 8. isRevision: Optional - Whether this is revising a previous stage
 75 |   - Boolean value (true/false)
 76 |   - Default: false
 77 | 9. revisesStage: Optional - If revising, which stage number is being revised
 78 |   - Required when isRevision is true
 79 |   - Indicates which previous stage is being updated
 80 | 
 81 | Status and Priority Management:
 82 | - The statusUpdates stage allows for batch updates to entity status values
 83 | - Valid status values include: active, completed, pending, abandoned
 84 | - Priority assignments (high, low) can be modified in the projectStatus stage
 85 | - Status changes are implemented through has_status relations
 86 | - Priority changes are implemented through has_priority relations
 87 | - Status and priority changes are tracked to maintain research progress history
 88 | 
 89 | Sequential Process Management:
 90 | - The projectStatus stage allows for defining or modifying sequential relationships
 91 | - The precedes relation is used to establish logical ordering between research processes
 92 | - Sequential updates help maintain a coherent research workflow
 93 | - Process sequences can be visualized through the loadcontext tool
 94 | - Critical research sequences are maintained to ensure methodological integrity
 95 | 
 96 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool performs these updates:
 97 | 1. Dataset Entities: Updates existing datasets or creates new dataset entities with the provided information
 98 | 2. Statistical Analyses: Creates entities for statistical tests and links them to projects and variables
 99 | 3. Visualizations: Creates entities for data visualizations and links them to datasets and projects
100 | 4. Hypothesis Updates: Updates existing hypotheses or creates new hypothesis entities with test results
101 | 5. Model Updates: Updates existing model entities or creates new models with performance metrics
102 | 6. Status Updates: Updates entity status values through has_status relations 
103 | 7. Priority Updates: Updates entity priority values through has_priority relations
104 | 8. Sequence Updates: Updates sequential relationships through precedes relations
105 | 9. Project Status: Updates the project status, adds an updated timestamp, and records observations
106 | 
107 | Return information:
108 | - JSON response with the following structure when stages are in progress:
109 |   * success: Boolean indicating whether the operation succeeded
110 |   * stageCompleted: The stage that was just completed
111 |   * nextStageNeeded: Whether more stages are required
112 |   * stageResult: The processed result of the current stage
113 | - Formatted markdown text summary when the session is completed, including:
114 |   * Session date and project name
115 |   * Summary of the session
116 |   * Dataset updates
117 |   * New statistical analyses
118 |   * New visualizations
119 |   * Hypothesis test results
120 |   * Model updates
121 |   * Status changes
122 |   * Priority modifications
123 |   * Sequential relationship updates
124 |   * Project status update
125 | 
126 | You should:
127 | - Complete all stages in order for comprehensive session documentation
128 | - Provide specific details in each stage for accurate research documentation
129 | - Specify dataset updates with clear size, variable count, and status information
130 | - Include p-values and variable names for statistical analyses
131 | - Connect visualizations to specific datasets when possible
132 | - Document hypothesis test results with evidence and significance levels
133 | - Include performance metrics when updating statistical models
134 | - Update entity status using has_status relations with valid status values (active, completed, pending, abandoned)
135 | - Assign priorities using has_priority relations with valid priority values (high, low)
136 | - Define process sequences using precedes relations to establish research workflows
137 | - Include relevant observations for project status updates
138 | - If making a revision, specify which stage is being revised
139 | - Only mark nextStageNeeded as false on the final assembly stage
140 | - Review the final summary message to confirm all session details were recorded properly
141 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/quantitativeresearch/quantitativeresearch_endsession.txt:
--------------------------------------------------------------------------------

```
  1 | A multi-stage tool for documenting quantitative research sessions, recording statistical analyses, tracking dataset updates, and creating a structured record of research evolution.
  2 | 
  3 | When to use this tool:
  4 | - Concluding a quantitative research analysis session
  5 | - Documenting updates to datasets and variables
  6 | - Recording new statistical analyses and test results
  7 | - Tracking creation of data visualizations
  8 | - Documenting hypothesis test results and conclusions
  9 | - Updating statistical model performance information
 10 | - Creating a structured record of research activities
 11 | - Establishing a formal conclusion to a focused research period
 12 | - Building a historical record of project development
 13 | - Documenting observations and insights from statistical analysis
 14 | - Updating status values for research activities and entities
 15 | - Assigning or modifying priority levels for research tasks
 16 | - Establishing or modifying sequential relationships between research processes
 17 | 
 18 | Key features:
 19 | - Provides a structured, multi-stage workflow for research session documentation
 20 | - Records dataset updates in the knowledge graph
 21 | - Captures new statistical analyses and their results
 22 | - Tracks creation of data visualizations and their purposes
 23 | - Documents hypothesis test outcomes with statistical significance
 24 | - Updates statistical model performance metrics
 25 | - Updates project status information
 26 | - Maintains session continuity with unique session IDs
 27 | - Supports revision of previous stages when needed
 28 | - Offers a comprehensive assembly stage that consolidates all session information
 29 | - Manages status progression of research activities
 30 | - Tracks priority assignments for research tasks
 31 | - Documents sequential relationships between research processes
 32 | 
 33 | The endsession tool uses a sequential, multi-stage approach with 9 typical stages:
 34 | 1. Summary Stage: Records basic session information
 35 | 2. Dataset Updates Stage: Documents changes to datasets
 36 | 3. New Analyses Stage: Records new statistical tests performed
 37 | 4. New Visualizations Stage: Documents visualizations created
 38 | 5. Hypothesis Results Stage: Records outcomes of hypothesis tests
 39 | 6. Model Updates Stage: Documents changes to statistical models
 40 | 7. Status Updates Stage: Records changes to entity status values
 41 | 8. Project Status Stage: Updates the overall project status
 42 | 9. Assembly Stage: Consolidates all information and finalizes the session record
 43 | 
 44 | Parameters explained:
 45 | 1. sessionId: Required - Unique identifier for the research session
 46 |   - Obtained from the startsession tool
 47 |   - Example: "quant_1234567890_abc123"
 48 | 2. stage: Required - Current stage of the endsession workflow
 49 |   - Accepts: "summary", "datasetUpdates", "newAnalyses", "newVisualizations", "hypothesisResults", "modelUpdates", "statusUpdates", "projectStatus", or "assembly"
 50 |   - Each stage has specific data requirements and processing logic
 51 | 3. stageNumber: Required - The sequence number of the current stage
 52 |   - Starts at 1 and typically progresses through the stages
 53 |   - Used to track progress through the session documentation workflow
 54 | 4. totalStages: Required - Total number of stages planned for this workflow
 55 |   - Typically 9 for the complete workflow
 56 |   - Provides context for the progress within the overall process
 57 | 5. analysis: Optional - Text analysis or observations for the current stage
 58 |   - Descriptive text explaining the work done in this stage
 59 |   - Example: "Analyzed multiple regression results and identified significant predictors"
 60 | 6. stageData: Optional - Stage-specific structured data
 61 |   - Structure varies by stage type:
 62 |     * summary: { summary: "Session summary text", duration: "3 hours", project: "ProjectName" }
 63 |     * datasetUpdates: { datasets: [{ name: "Dataset1", size: "500 rows", variables: "10", status: "active", description: "Dataset description" }] }
 64 |     * newAnalyses: { analyses: [{ name: "Analysis1", type: "regression", result: "p<0.05", pValue: "0.03", variables: ["var1", "var2"] }] }
 65 |     * newVisualizations: { visualizations: [{ name: "Viz1", type: "scatter", description: "Correlation visualization", datasetName: "Dataset1" }] }
 66 |     * hypothesisResults: { hypotheses: [{ name: "H1", status: "completed", evidence: "Statistical significance in regression model", pValue: "0.02" }] }
 67 |     * modelUpdates: { models: [{ name: "Model1", type: "regression", performance: "R²=0.85", variables: ["var1", "var2"] }] }
 68 |     * statusUpdates: { statusUpdates: [{ entityName: "Dataset1", newStatus: "completed", note: "Data cleaning and validation complete" }, { entityName: "Model2", newStatus: "active", note: "Model training in progress" }] }
 69 |     * projectStatus: { projectStatus: "active", projectObservation: "Data analysis phase complete", priorityUpdates: [{ entityName: "AnalysisTask1", priority: "high", note: "Critical for upcoming publication" }], sequenceUpdates: [{ before: "DataCleaning", after: "ModelTraining", note: "Reorganized analysis workflow" }] }
 70 |     * assembly: No stageData needed - automatically assembled from previous stages
 71 | 7. nextStageNeeded: Required - Whether additional stages are needed after this one
 72 |   - Boolean value (true/false)
 73 |   - Set to false on the final stage to complete the session
 74 | 8. isRevision: Optional - Whether this is revising a previous stage
 75 |   - Boolean value (true/false)
 76 |   - Default: false
 77 | 9. revisesStage: Optional - If revising, which stage number is being revised
 78 |   - Required when isRevision is true
 79 |   - Indicates which previous stage is being updated
 80 | 
 81 | Status and Priority Management:
 82 | - The statusUpdates stage allows for batch updates to entity status values
 83 | - Valid status values include: active, completed, pending, abandoned
 84 | - Priority assignments (high, low) can be modified in the projectStatus stage
 85 | - Status changes are implemented through has_status relations
 86 | - Priority changes are implemented through has_priority relations
 87 | - Status and priority changes are tracked to maintain research progress history
 88 | 
 89 | Sequential Process Management:
 90 | - The projectStatus stage allows for defining or modifying sequential relationships
 91 | - The precedes relation is used to establish logical ordering between research processes
 92 | - Sequential updates help maintain a coherent research workflow
 93 | - Process sequences can be visualized through the loadcontext tool
 94 | - Critical research sequences are maintained to ensure methodological integrity
 95 | 
 96 | When the endsession workflow completes (assembly stage with nextStageNeeded: false), the tool performs these updates:
 97 | 1. Dataset Entities: Updates existing datasets or creates new dataset entities with the provided information
 98 | 2. Statistical Analyses: Creates entities for statistical tests and links them to projects and variables
 99 | 3. Visualizations: Creates entities for data visualizations and links them to datasets and projects
100 | 4. Hypothesis Updates: Updates existing hypotheses or creates new hypothesis entities with test results
101 | 5. Model Updates: Updates existing model entities or creates new models with performance metrics
102 | 6. Status Updates: Updates entity status values through has_status relations 
103 | 7. Priority Updates: Updates entity priority values through has_priority relations
104 | 8. Sequence Updates: Updates sequential relationships through precedes relations
105 | 9. Project Status: Updates the project status, adds an updated timestamp, and records observations
106 | 
107 | Return information:
108 | - JSON response with the following structure when stages are in progress:
109 |   * success: Boolean indicating whether the operation succeeded
110 |   * stageCompleted: The stage that was just completed
111 |   * nextStageNeeded: Whether more stages are required
112 |   * stageResult: The processed result of the current stage
113 | - Formatted markdown text summary when the session is completed, including:
114 |   * Session date and project name
115 |   * Summary of the session
116 |   * Dataset updates
117 |   * New statistical analyses
118 |   * New visualizations
119 |   * Hypothesis test results
120 |   * Model updates
121 |   * Status changes
122 |   * Priority modifications
123 |   * Sequential relationship updates
124 |   * Project status update
125 | 
126 | You should:
127 | - Complete all stages in order for comprehensive session documentation
128 | - Provide specific details in each stage for accurate research documentation
129 | - Specify dataset updates with clear size, variable count, and status information
130 | - Include p-values and variable names for statistical analyses
131 | - Connect visualizations to specific datasets when possible
132 | - Document hypothesis test results with evidence and significance levels
133 | - Include performance metrics when updating statistical models
134 | - Update entity status using has_status relations with valid status values (active, completed, pending, abandoned)
135 | - Assign priorities using has_priority relations with valid priority values (high, low)
136 | - Define process sequences using precedes relations to establish research workflows
137 | - Include relevant observations for project status updates
138 | - If making a revision, specify which stage is being revised
139 | - Only mark nextStageNeeded as false on the final assembly stage
140 | - Review the final summary message to confirm all session details were recorded properly
141 | - Use the unique session ID consistently across all stages 
```

--------------------------------------------------------------------------------
/main/index.js:
--------------------------------------------------------------------------------

```javascript
  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 { Client } from "@modelcontextprotocol/sdk/client/index.js";
  5 | import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
  6 | import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
  7 | import { z } from "zod";
  8 | import path from "path";
  9 | import { fileURLToPath } from "url";
 10 | // Get the directory where the contextmanager is located
 11 | const __filename = fileURLToPath(import.meta.url);
 12 | const __dirname = path.dirname(__filename);
 13 | // Domain client class
 14 | class DomainClient {
 15 |     constructor(domain) {
 16 |         this.domain = domain;
 17 |         this.client = null;
 18 |         this.transport = null;
 19 |         this.connected = false;
 20 |         this.process = null;
 21 |         this.name = domain.name;
 22 |     }
 23 |     async connect() {
 24 |         if (this.connected) {
 25 |             return true;
 26 |         }
 27 |         try {
 28 |             // Create client
 29 |             this.client = new Client({
 30 |                 name: `contextmanager-${this.name}-client`,
 31 |                 version: "1.0.0"
 32 |             }, {
 33 |                 capabilities: {
 34 |                     resources: {},
 35 |                     tools: {},
 36 |                     prompts: {}
 37 |                 }
 38 |             });
 39 |             // Connect to domain server
 40 |             if (this.domain.host && this.domain.port) {
 41 |                 // Connect via SSE
 42 |                 const url = new URL(`http://${this.domain.host}:${this.domain.port}${this.domain.path || '/sse'}`);
 43 |                 this.transport = new SSEClientTransport(url);
 44 |             }
 45 |             else if (this.domain.command) {
 46 |                 // Connect via stdio
 47 |                 this.transport = new StdioClientTransport({
 48 |                     command: this.domain.command,
 49 |                     args: this.domain.args || [],
 50 |                 });
 51 |             }
 52 |             else {
 53 |                 console.error(`Domain ${this.name} has no connection information`);
 54 |                 return false;
 55 |             }
 56 |             await this.client.connect(this.transport);
 57 |             this.connected = true;
 58 |             return true;
 59 |         }
 60 |         catch (error) {
 61 |             console.error(`Failed to connect to domain ${this.name}:`, error);
 62 |             this.connected = false;
 63 |             return false;
 64 |         }
 65 |     }
 66 |     async disconnect() {
 67 |         if (!this.connected) {
 68 |             return;
 69 |         }
 70 |         try {
 71 |             if (this.client) {
 72 |                 // Manually close the transport as there's no official disconnect method
 73 |                 if (this.transport) {
 74 |                     if ('close' in this.transport) {
 75 |                         await this.transport.close();
 76 |                     }
 77 |                 }
 78 |             }
 79 |             this.connected = false;
 80 |         }
 81 |         catch (error) {
 82 |             console.error(`Error disconnecting from domain ${this.name}:`, error);
 83 |         }
 84 |     }
 85 |     async callTool(toolRequest) {
 86 |         if (!this.connected || !this.client) {
 87 |             const connected = await this.connect();
 88 |             if (!connected) {
 89 |                 return {
 90 |                     content: [{ type: "text", text: `Error: Not connected to domain ${this.name}` }],
 91 |                     isError: true
 92 |                 };
 93 |             }
 94 |         }
 95 |         try {
 96 |             if (!this.client) {
 97 |                 throw new Error(`Client for domain ${this.name} is not initialized`);
 98 |             }
 99 |             const result = await this.client.callTool(toolRequest);
100 |             return result;
101 |         }
102 |         catch (error) {
103 |             console.error(`Error calling tool ${toolRequest.name} on domain ${this.name}:`, error);
104 |             return {
105 |                 content: [{ type: "text", text: `Error calling tool ${toolRequest.name} on domain ${this.name}: ${error}` }],
106 |                 isError: true
107 |             };
108 |         }
109 |     }
110 |     async readResource(resourceRequest) {
111 |         if (!this.connected || !this.client) {
112 |             const connected = await this.connect();
113 |             if (!connected) {
114 |                 return {
115 |                     contents: [{
116 |                             uri: resourceRequest.uri,
117 |                             text: `Error: Not connected to domain ${this.name}`
118 |                         }]
119 |                 };
120 |             }
121 |         }
122 |         try {
123 |             if (!this.client) {
124 |                 throw new Error(`Client for domain ${this.name} is not initialized`);
125 |             }
126 |             return await this.client.readResource(resourceRequest);
127 |         }
128 |         catch (error) {
129 |             console.error(`Error reading resource ${resourceRequest.uri} from domain ${this.name}:`, error);
130 |             return {
131 |                 contents: [{
132 |                         uri: resourceRequest.uri,
133 |                         text: `Error reading resource: ${error}`
134 |                     }]
135 |             };
136 |         }
137 |     }
138 | }
139 | // In-memory storage
140 | const domains = [
141 |     {
142 |         name: "developer",
143 |         description: "Software development context with entities like projects, components, and tasks",
144 |         entityTypes: ["project", "component", "task", "issue", "commit"],
145 |         command: "node",
146 |         args: [path.resolve(__dirname, "../developer/index.js")]
147 |     },
148 |     {
149 |         name: "project",
150 |         description: "Project management context with entities like projects, tasks, and resources",
151 |         entityTypes: ["project", "task", "resource", "milestone", "risk"],
152 |         command: "node",
153 |         args: [path.resolve(__dirname, "../project/index.js")]
154 |     },
155 |     {
156 |         name: "student",
157 |         description: "Educational context with entities like courses, assignments, and exams",
158 |         entityTypes: ["course", "assignment", "exam", "note", "grade"],
159 |         command: "node",
160 |         args: [path.resolve(__dirname, "../student/index.js")]
161 |     },
162 |     {
163 |         name: "qualitativeresearch",
164 |         description: "Qualitative research context with entities like studies, participants, and interviews",
165 |         entityTypes: ["study", "participant", "interview", "code", "theme"],
166 |         command: "node",
167 |         args: [path.resolve(__dirname, "../qualitativeresearch/index.js")]
168 |     },
169 |     {
170 |         name: "quantitativeresearch",
171 |         description: "Quantitative research context with entities like datasets, variables, and analyses",
172 |         entityTypes: ["dataset", "variable", "analysis", "model", "result"],
173 |         command: "node",
174 |         args: [path.resolve(__dirname, "../quantitativeresearch/index.js")]
175 |     }
176 | ];
177 | // Domain clients
178 | const domainClients = {};
179 | // Initialize domain clients
180 | for (const domain of domains) {
181 |     domainClients[domain.name] = new DomainClient(domain);
182 | }
183 | // In-memory flow management
184 | const flows = [];
185 | let activeDomain = null;
186 | let flowCounter = 0;
187 | // Create an MCP server
188 | const server = new McpServer({
189 |     name: "Context Manager",
190 |     version: "1.0.0"
191 | });
192 | // Domain management tools
193 | server.tool("setActiveDomain", { domain: z.string() }, async ({ domain }) => {
194 |     const foundDomain = domains.find(d => d.name.toLowerCase() === domain.toLowerCase());
195 |     if (!foundDomain) {
196 |         return {
197 |             content: [{ type: "text", text: `Error: Domain '${domain}' not found. Available domains: ${domains.map(d => d.name).join(", ")}` }],
198 |             isError: true
199 |         };
200 |     }
201 |     // Connect to the domain server
202 |     const domainClient = domainClients[foundDomain.name];
203 |     const connected = await domainClient.connect();
204 |     if (!connected) {
205 |         return {
206 |             content: [{ type: "text", text: `Error: Could not connect to domain server for '${domain}'` }],
207 |             isError: true
208 |         };
209 |     }
210 |     activeDomain = foundDomain.name;
211 |     return {
212 |         content: [{ type: "text", text: `Active domain set to: ${activeDomain}` }]
213 |     };
214 | });
215 | // Flow management tools
216 | server.tool("startsession", {
217 |     domain: z.string()
218 | }, async ({ domain }) => {
219 |     const foundDomain = domains.find(d => d.name.toLowerCase() === domain.toLowerCase());
220 |     if (!foundDomain) {
221 |         return {
222 |             content: [{ type: "text", text: `Error: Domain '${domain}' not found. Available domains: ${domains.map(d => d.name).join(", ")}` }],
223 |             isError: true
224 |         };
225 |     }
226 |     // Connect to the domain server
227 |     const domainClient = domainClients[foundDomain.name];
228 |     const connected = await domainClient.connect();
229 |     if (!connected) {
230 |         return {
231 |             content: [{ type: "text", text: `Error: Could not connect to domain server for '${domain}'` }],
232 |             isError: true
233 |         };
234 |     }
235 |     activeDomain = foundDomain.name;
236 |     flowCounter++;
237 |     // Forward the startsession call to the domain server with a domain-specific session identifier
238 |     try {
239 |         const result = await domainClient.callTool({
240 |             name: "startsession",
241 |             arguments: {}
242 |         });
243 |         const lastWord = result.content[0].text.split(' ').pop();
244 |         // Create a contextmanager flow ID from domain session ID (last word)
245 |         const flowId = `flow_${lastWord}`;
246 |         flows.push({
247 |             id: flowId,
248 |             domain: activeDomain,
249 |             active: true,
250 |             createdAt: Date.now()
251 |         });
252 |         return {
253 |             content: [
254 |                 { type: "text", text: `${result.content[0].text}` }
255 |             ],
256 |         };
257 |     }
258 |     catch (error) {
259 |         console.error(`Error starting session for domain ${activeDomain}:`, error);
260 |         return {
261 |             content: [{ type: "text", text: `Error starting session for domain ${activeDomain}: ${error}` }],
262 |             isError: true
263 |         };
264 |     }
265 | });
266 | server.tool("endsession", {
267 |     sessionId: z.string(),
268 |     stage: z.string(),
269 |     stageNumber: z.number(),
270 |     totalStages: z.number(),
271 |     nextStageNeeded: z.boolean(),
272 |     analysis: z.string().optional(),
273 |     isRevision: z.boolean().optional(),
274 |     revisesStage: z.number().optional(),
275 |     stageData: z.any().optional()
276 | }, async ({ sessionId, stage, stageNumber, totalStages, nextStageNeeded, analysis, isRevision, revisesStage, stageData }) => {
277 |     const flowId = `flow_${sessionId}`;
278 |     const flowIndex = flows.findIndex(s => s.id === flowId);
279 |     if (flowIndex === -1) {
280 |         return {
281 |             content: [{ type: "text", text: `Error: Context Manager flow with ID '${flowId}' not found.` }],
282 |             isError: true
283 |         };
284 |     }
285 |     const flow = flows[flowIndex];
286 |     const domainName = flow.domain;
287 |     const domainClient = domainClients[domainName];
288 |     if (!domainClient || !domainClient.connected) {
289 |         const connected = await domainClient.connect();
290 |         if (!connected) {
291 |             return {
292 |                 content: [{ type: "text", text: `Error: Could not connect to domain server for '${domainName}'` }],
293 |                 isError: true
294 |             };
295 |         }
296 |     }
297 |     // Forward the endsession call to the domain server
298 |     try {
299 |         const result = await domainClient.callTool({
300 |             name: "endsession",
301 |             arguments: {
302 |                 sessionId: sessionId,
303 |                 stage,
304 |                 stageNumber,
305 |                 totalStages,
306 |                 nextStageNeeded,
307 |                 analysis,
308 |                 isRevision,
309 |                 revisesStage,
310 |                 stageData
311 |             }
312 |         });
313 |         if (!nextStageNeeded) {
314 |             flows[flowIndex].active = false;
315 |             return {
316 |                 content: [{ type: "text", text: `${result.content[0].text}` }]
317 |             };
318 |         }
319 |         return {
320 |             content: [{ type: "text", text: `${result.content[0].text}` }]
321 |         };
322 |     }
323 |     catch (error) {
324 |         console.error(`Error ending session for domain ${domainName}:`, error);
325 |         return {
326 |             content: [{ type: "text", text: `Error ending session for domain ${domainName}: ${error}` }],
327 |             isError: true
328 |         };
329 |     }
330 | });
331 | // Context management tools
332 | server.tool("buildcontext", {
333 |     type: z.enum(["entities", "relations", "observations"]),
334 |     data: z.any().optional()
335 | }, async ({ type, data }) => {
336 |     if (!activeDomain) {
337 |         return {
338 |             content: [{ type: "text", text: "Error: No active domain set. Use setActiveDomain tool first." }],
339 |             isError: true
340 |         };
341 |     }
342 |     const domainClient = domainClients[activeDomain];
343 |     if (!domainClient || !domainClient.connected) {
344 |         const connected = await domainClient.connect();
345 |         if (!connected) {
346 |             return {
347 |                 content: [{ type: "text", text: `Error: Could not connect to domain server for '${activeDomain}'` }],
348 |                 isError: true
349 |             };
350 |         }
351 |     }
352 |     // Forward the buildcontext call to the domain server
353 |     try {
354 |         const result = await domainClient.callTool({
355 |             name: "buildcontext",
356 |             arguments: {
357 |                 type,
358 |                 data
359 |             }
360 |         });
361 |         return result;
362 |     }
363 |     catch (error) {
364 |         console.error(`Error building context for domain ${activeDomain}:`, error);
365 |         return {
366 |             content: [{ type: "text", text: `Error building context for domain ${activeDomain}: ${error}` }],
367 |             isError: true
368 |         };
369 |     }
370 | });
371 | server.tool("deletecontext", {
372 |     type: z.enum(["entities", "relations", "observations"]),
373 |     data: z.any().optional()
374 | }, async ({ type, data }) => {
375 |     if (!activeDomain) {
376 |         return {
377 |             content: [{ type: "text", text: "Error: No active domain set. Use setActiveDomain tool first." }],
378 |             isError: true
379 |         };
380 |     }
381 |     const domainClient = domainClients[activeDomain];
382 |     if (!domainClient || !domainClient.connected) {
383 |         const connected = await domainClient.connect();
384 |         if (!connected) {
385 |             return {
386 |                 content: [{ type: "text", text: `Error: Could not connect to domain server for '${activeDomain}'` }],
387 |                 isError: true
388 |             };
389 |         }
390 |     }
391 |     // Forward the deletecontext call to the domain server
392 |     try {
393 |         const result = await domainClient.callTool({
394 |             name: "deletecontext",
395 |             arguments: {
396 |                 type,
397 |                 data
398 |             }
399 |         });
400 |         return result;
401 |     }
402 |     catch (error) {
403 |         console.error(`Error deleting context for domain ${activeDomain}:`, error);
404 |         return {
405 |             content: [{ type: "text", text: `Error deleting context for domain ${activeDomain}: ${error}` }],
406 |             isError: true
407 |         };
408 |     }
409 | });
410 | server.tool("loadcontext", {
411 |     entityName: z.string(),
412 |     entityType: z.string().optional(),
413 |     sessionId: z.string().optional()
414 | }, async ({ entityName, entityType, sessionId }) => {
415 |     if (!activeDomain) {
416 |         return {
417 |             content: [{ type: "text", text: "Error: No active domain set. Use setActiveDomain tool first." }],
418 |             isError: true
419 |         };
420 |     }
421 |     const flowId = `flow_${sessionId}`;
422 |     // Find active contextmanager flow or use provided sessionId
423 |     let targetFlow;
424 |     if (sessionId) {
425 |         targetFlow = flows.find(s => s.id === flowId);
426 |     }
427 |     else {
428 |         targetFlow = flows.find(s => s.domain === activeDomain && s.active);
429 |     }
430 |     if (!targetFlow) {
431 |         return {
432 |             content: [{ type: "text", text: "Error: No active Context Manager flow found. Start a flow first." }],
433 |             isError: true
434 |         };
435 |     }
436 |     const domainClient = domainClients[activeDomain];
437 |     if (!domainClient || !domainClient.connected) {
438 |         const connected = await domainClient.connect();
439 |         if (!connected) {
440 |             return {
441 |                 content: [{ type: "text", text: `Error: Could not connect to domain server for '${activeDomain}'` }],
442 |                 isError: true
443 |             };
444 |         }
445 |     }
446 |     // Update contextmanager flow with entity details
447 |     targetFlow.entityName = entityName;
448 |     targetFlow.entityType = entityType || "unknown";
449 |     // Forward the loadcontext call to the domain server
450 |     try {
451 |         const result = await domainClient.callTool({
452 |             name: "loadcontext",
453 |             arguments: {
454 |                 entityName,
455 |                 entityType,
456 |                 sessionId: sessionId
457 |             }
458 |         });
459 |         return {
460 |             content: [{
461 |                     type: "text",
462 |                     text: `${result.content[0].text}`
463 |                 }]
464 |         };
465 |     }
466 |     catch (error) {
467 |         console.error(`Error loading context for domain ${activeDomain}:`, error);
468 |         return {
469 |             content: [{ type: "text", text: `Error loading context for domain ${activeDomain}: ${error}` }],
470 |             isError: true
471 |         };
472 |     }
473 | });
474 | server.tool("advancedcontext", {
475 |     type: z.enum(["graph", "search", "nodes", "related", "decisions", "milestone"]),
476 |     params: z.any().optional()
477 | }, async ({ type, params }) => {
478 |     if (!activeDomain) {
479 |         return {
480 |             content: [{ type: "text", text: "Error: No active domain set. Use setActiveDomain tool first." }],
481 |             isError: true
482 |         };
483 |     }
484 |     const domainClient = domainClients[activeDomain];
485 |     if (!domainClient || !domainClient.connected) {
486 |         const connected = await domainClient.connect();
487 |         if (!connected) {
488 |             return {
489 |                 content: [{ type: "text", text: `Error: Could not connect to domain server for '${activeDomain}'` }],
490 |                 isError: true
491 |             };
492 |         }
493 |     }
494 |     // Forward the advancedcontext call to the domain server
495 |     try {
496 |         const result = await domainClient.callTool({
497 |             name: "advancedcontext",
498 |             arguments: {
499 |                 type,
500 |                 params
501 |             }
502 |         });
503 |         return result;
504 |     }
505 |     catch (error) {
506 |         console.error(`Error performing advanced context operation for domain ${activeDomain}:`, error);
507 |         return {
508 |             content: [{ type: "text", text: `Error performing advanced context operation for domain ${activeDomain}: ${error}` }],
509 |             isError: true
510 |         };
511 |     }
512 | });
513 | // // List all entities
514 | // server.tool(
515 | //   "listAllEntities",
516 | //   {
517 | //     domain: z.string().optional()
518 | //   },
519 | //   async () => {
520 | //     if (!activeDomain) {
521 | //       return {
522 | //         content: [{ type: "text", text: "Error: No active domain set. Use setActiveDomain tool first." }],
523 | //         isError: true
524 | //       };
525 | //     }
526 | //     const domainClient = domainClients[activeDomain];
527 | //     if (!domainClient || !domainClient.connected) {
528 | //       const connected = await domainClient.connect();
529 | //       if (!connected) {
530 | //         return {
531 | //           content: [{ type: "text", text: `Error: Could not connect to domain server for '${activeDomain}'` }],
532 | //           isError: true
533 | //         };
534 | //       }
535 | //     }
536 | //     // Forward the listAllEntities call to the domain server
537 | //     try {
538 | //       const result = await domainClient.callTool({
539 | //         name: "listAllEntities",
540 | //         arguments: {}
541 | //       });
542 | //       return result;
543 | //     } catch (error) {
544 | //       // If the domain server doesn't support listAllEntities, fall back to our domain registry
545 | //       const domain = domains.find(d => d.name === activeDomain);
546 | //       if (!domain) {
547 | //         return {
548 | //           content: [{ type: "text", text: `Error: Domain '${activeDomain}' not found.` }],
549 | //           isError: true
550 | //         };
551 | //       }
552 | //       return {
553 | //         content: [{ 
554 | //           type: "text", 
555 | //           text: `Available entity types in ${activeDomain} domain: ${domain.entityTypes.join(", ")}` 
556 | //         }]
557 | //       };
558 | //     }
559 | //   }
560 | // );
561 | // Domain discovery resources
562 | server.resource("domains", "domains://list", async (uri) => ({
563 |     contents: [{
564 |             uri: uri.href,
565 |             text: JSON.stringify(domains, null, 2)
566 |         }]
567 | }));
568 | // Cross-domain functionality
569 | server.tool("relateCrossDomain", {
570 |     fromDomain: z.string(),
571 |     fromEntity: z.string(),
572 |     toDomain: z.string(),
573 |     toEntity: z.string(),
574 |     relationType: z.string()
575 | }, async ({ fromDomain, fromEntity, toDomain, toEntity, relationType }) => {
576 |     // Validate domains
577 |     const fromDomainInfo = domains.find(d => d.name.toLowerCase() === fromDomain.toLowerCase());
578 |     const toDomainInfo = domains.find(d => d.name.toLowerCase() === toDomain.toLowerCase());
579 |     if (!fromDomainInfo) {
580 |         return {
581 |             content: [{ type: "text", text: `Error: Source domain '${fromDomain}' not found.` }],
582 |             isError: true
583 |         };
584 |     }
585 |     if (!toDomainInfo) {
586 |         return {
587 |             content: [{ type: "text", text: `Error: Target domain '${toDomain}' not found.` }],
588 |             isError: true
589 |         };
590 |     }
591 |     // Create cross-domain relation by adding observations to both entities
592 |     try {
593 |         // Connect to source domain
594 |         const fromDomainClient = domainClients[fromDomainInfo.name];
595 |         if (!fromDomainClient || !fromDomainClient.connected) {
596 |             const connected = await fromDomainClient.connect();
597 |             if (!connected) {
598 |                 return {
599 |                     content: [{ type: "text", text: `Error: Could not connect to domain server for '${fromDomain}'` }],
600 |                     isError: true
601 |                 };
602 |             }
603 |         }
604 |         // Connect to target domain
605 |         const toDomainClient = domainClients[toDomainInfo.name];
606 |         if (!toDomainClient || !toDomainClient.connected) {
607 |             const connected = await toDomainClient.connect();
608 |             if (!connected) {
609 |                 return {
610 |                     content: [{ type: "text", text: `Error: Could not connect to domain server for '${toDomain}'` }],
611 |                     isError: true
612 |                 };
613 |             }
614 |         }
615 |         // Add observation to source entity about relation to target entity
616 |         await fromDomainClient.callTool({
617 |             name: "buildcontext",
618 |             arguments: {
619 |                 type: "observations",
620 |                 data: {
621 |                     observations: [
622 |                         {
623 |                             entityName: fromEntity,
624 |                             contents: [`Related to ${toEntity} (${toDomainInfo.name} domain) via ${relationType}`]
625 |                         }
626 |                     ]
627 |                 }
628 |             }
629 |         });
630 |         // Add observation to target entity about relation from source entity
631 |         await toDomainClient.callTool({
632 |             name: "buildcontext",
633 |             arguments: {
634 |                 type: "observations",
635 |                 data: {
636 |                     observations: [
637 |                         {
638 |                             entityName: toEntity,
639 |                             contents: [`Related from ${fromEntity} (${fromDomainInfo.name} domain) via ${relationType}`]
640 |                         }
641 |                     ]
642 |                 }
643 |             }
644 |         });
645 |         return {
646 |             content: [{
647 |                     type: "text",
648 |                     text: `Created cross-domain relation: ${fromEntity} (${fromDomain}) --[${relationType}]--> ${toEntity} (${toDomain})`
649 |                 }]
650 |         };
651 |     }
652 |     catch (error) {
653 |         console.error(`Error creating cross-domain relation:`, error);
654 |         return {
655 |             content: [{ type: "text", text: `Error creating cross-domain relation: ${error}` }],
656 |             isError: true
657 |         };
658 |     }
659 | });
660 | // Main function to start the server
661 | async function main() {
662 |     // Start receiving messages on stdin and sending messages on stdout
663 |     const transport = new StdioServerTransport();
664 |     await server.connect(transport);
665 | }
666 | // Execute the main function
667 | main().catch(error => {
668 |     console.error("Error in contextmanager:", error);
669 |     process.exit(1);
670 | });
671 | 
```

--------------------------------------------------------------------------------
/main/mcp.ts:
--------------------------------------------------------------------------------

```typescript
  1 | import { Server, ServerOptions } from "@modelcontextprotocol/sdk/server/index.js";
  2 | import { zodToJsonSchema } from "zod-to-json-schema";
  3 | import {
  4 |   z,
  5 |   ZodRawShape,
  6 |   ZodObject,
  7 |   ZodString,
  8 |   AnyZodObject,
  9 |   ZodTypeAny,
 10 |   ZodType,
 11 |   ZodTypeDef,
 12 |   ZodOptional,
 13 | } from "zod";
 14 | import {
 15 |   Implementation,
 16 |   Tool,
 17 |   ListToolsResult,
 18 |   CallToolResult,
 19 |   McpError,
 20 |   ErrorCode,
 21 |   CompleteRequest,
 22 |   CompleteResult,
 23 |   PromptReference,
 24 |   ResourceReference,
 25 |   Resource,
 26 |   ListResourcesResult,
 27 |   ListResourceTemplatesRequestSchema,
 28 |   ReadResourceRequestSchema,
 29 |   ListToolsRequestSchema,
 30 |   CallToolRequestSchema,
 31 |   ListResourcesRequestSchema,
 32 |   ListPromptsRequestSchema,
 33 |   GetPromptRequestSchema,
 34 |   CompleteRequestSchema,
 35 |   ListPromptsResult,
 36 |   Prompt,
 37 |   PromptArgument,
 38 |   GetPromptResult,
 39 |   ReadResourceResult,
 40 | } from "@modelcontextprotocol/sdk/types.js";
 41 | import { Completable, CompletableDef } from "@modelcontextprotocol/sdk/server/completable.js";
 42 | import { UriTemplate, Variables } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
 43 | import { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
 44 | import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
 45 | 
 46 | /**
 47 |  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
 48 |  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
 49 |  * Server instance available via the `server` property.
 50 |  */
 51 | export class McpServer {
 52 |   /**
 53 |    * The underlying Server instance, useful for advanced operations like sending notifications.
 54 |    */
 55 |   public readonly server: Server;
 56 | 
 57 |   private _registeredResources: { [uri: string]: RegisteredResource } = {};
 58 |   private _registeredResourceTemplates: {
 59 |     [name: string]: RegisteredResourceTemplate;
 60 |   } = {};
 61 |   private _registeredTools: { [name: string]: RegisteredTool } = {};
 62 |   private _registeredPrompts: { [name: string]: RegisteredPrompt } = {};
 63 | 
 64 |   constructor(serverInfo: Implementation, options?: ServerOptions) {
 65 |     this.server = new Server(serverInfo, options);
 66 |   }
 67 | 
 68 |   /**
 69 |    * Attaches to the given transport, starts it, and starts listening for messages.
 70 |    *
 71 |    * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
 72 |    */
 73 |   async connect(transport: Transport): Promise<void> {
 74 |     return await this.server.connect(transport);
 75 |   }
 76 | 
 77 |   /**
 78 |    * Closes the connection.
 79 |    */
 80 |   async close(): Promise<void> {
 81 |     await this.server.close();
 82 |   }
 83 | 
 84 |   private _toolHandlersInitialized = false;
 85 | 
 86 |   private setToolRequestHandlers() {
 87 |     if (this._toolHandlersInitialized) {
 88 |       return;
 89 |     }
 90 |     
 91 |     this.server.assertCanSetRequestHandler(
 92 |       ListToolsRequestSchema.shape.method.value,
 93 |     );
 94 |     this.server.assertCanSetRequestHandler(
 95 |       CallToolRequestSchema.shape.method.value,
 96 |     );
 97 | 
 98 |     this.server.registerCapabilities({
 99 |       tools: {},
100 |     });
101 | 
102 |     this.server.setRequestHandler(
103 |       ListToolsRequestSchema,
104 |       (): ListToolsResult => ({
105 |         tools: Object.entries(this._registeredTools).map(
106 |           ([name, tool]): Tool => {
107 |             return {
108 |               name,
109 |               description: tool.description,
110 |               inputSchema: tool.inputSchema
111 |                 ? (zodToJsonSchema(tool.inputSchema, {
112 |                     strictUnions: true,
113 |                   }) as Tool["inputSchema"])
114 |                 : EMPTY_OBJECT_JSON_SCHEMA,
115 |             };
116 |           },
117 |         ),
118 |       }),
119 |     );
120 | 
121 |     this.server.setRequestHandler(
122 |       CallToolRequestSchema,
123 |       async (request, extra): Promise<CallToolResult> => {
124 |         const tool = this._registeredTools[request.params.name];
125 |         if (!tool) {
126 |           throw new McpError(
127 |             ErrorCode.InvalidParams,
128 |             `Tool ${request.params.name} not found`,
129 |           );
130 |         }
131 | 
132 |         if (tool.inputSchema) {
133 |           const parseResult = await tool.inputSchema.safeParseAsync(
134 |             request.params.arguments,
135 |           );
136 |           if (!parseResult.success) {
137 |             throw new McpError(
138 |               ErrorCode.InvalidParams,
139 |               `Invalid arguments for tool ${request.params.name}: ${parseResult.error.message}`,
140 |             );
141 |           }
142 | 
143 |           const args = parseResult.data;
144 |           const cb = tool.callback as ToolCallback<ZodRawShape>;
145 |           try {
146 |             return await Promise.resolve(cb(args, extra));
147 |           } catch (error) {
148 |             return {
149 |               content: [
150 |                 {
151 |                   type: "text",
152 |                   text: error instanceof Error ? error.message : String(error),
153 |                 },
154 |               ],
155 |               isError: true,
156 |             };
157 |           }
158 |         } else {
159 |           const cb = tool.callback as ToolCallback<undefined>;
160 |           try {
161 |             return await Promise.resolve(cb(extra));
162 |           } catch (error) {
163 |             return {
164 |               content: [
165 |                 {
166 |                   type: "text",
167 |                   text: error instanceof Error ? error.message : String(error),
168 |                 },
169 |               ],
170 |               isError: true,
171 |             };
172 |           }
173 |         }
174 |       },
175 |     );
176 | 
177 |     this._toolHandlersInitialized = true;
178 |   }
179 | 
180 |   private _completionHandlerInitialized = false;
181 | 
182 |   private setCompletionRequestHandler() {
183 |     if (this._completionHandlerInitialized) {
184 |       return;
185 |     }
186 | 
187 |     this.server.assertCanSetRequestHandler(
188 |       CompleteRequestSchema.shape.method.value,
189 |     );
190 | 
191 |     this.server.setRequestHandler(
192 |       CompleteRequestSchema,
193 |       async (request): Promise<CompleteResult> => {
194 |         switch (request.params.ref.type) {
195 |           case "ref/prompt":
196 |             return this.handlePromptCompletion(request, request.params.ref);
197 | 
198 |           case "ref/resource":
199 |             return this.handleResourceCompletion(request, request.params.ref);
200 | 
201 |           default:
202 |             throw new McpError(
203 |               ErrorCode.InvalidParams,
204 |               `Invalid completion reference: ${request.params.ref}`,
205 |             );
206 |         }
207 |       },
208 |     );
209 | 
210 |     this._completionHandlerInitialized = true;
211 |   }
212 | 
213 |   private async handlePromptCompletion(
214 |     request: CompleteRequest,
215 |     ref: PromptReference,
216 |   ): Promise<CompleteResult> {
217 |     const prompt = this._registeredPrompts[ref.name];
218 |     if (!prompt) {
219 |       throw new McpError(
220 |         ErrorCode.InvalidParams,
221 |         `Prompt ${request.params.ref.name} not found`,
222 |       );
223 |     }
224 | 
225 |     if (!prompt.argsSchema) {
226 |       return EMPTY_COMPLETION_RESULT;
227 |     }
228 | 
229 |     const field = prompt.argsSchema.shape[request.params.argument.name];
230 |     if (!(field instanceof Completable)) {
231 |       return EMPTY_COMPLETION_RESULT;
232 |     }
233 | 
234 |     const def: CompletableDef<ZodString> = field._def;
235 |     const suggestions = await def.complete(request.params.argument.value);
236 |     return createCompletionResult(suggestions);
237 |   }
238 | 
239 |   private async handleResourceCompletion(
240 |     request: CompleteRequest,
241 |     ref: ResourceReference,
242 |   ): Promise<CompleteResult> {
243 |     const template = Object.values(this._registeredResourceTemplates).find(
244 |       (t) => t.resourceTemplate.uriTemplate.toString() === ref.uri,
245 |     );
246 | 
247 |     if (!template) {
248 |       if (this._registeredResources[ref.uri]) {
249 |         // Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be).
250 |         return EMPTY_COMPLETION_RESULT;
251 |       }
252 | 
253 |       throw new McpError(
254 |         ErrorCode.InvalidParams,
255 |         `Resource template ${request.params.ref.uri} not found`,
256 |       );
257 |     }
258 | 
259 |     const completer = template.resourceTemplate.completeCallback(
260 |       request.params.argument.name,
261 |     );
262 |     if (!completer) {
263 |       return EMPTY_COMPLETION_RESULT;
264 |     }
265 | 
266 |     const suggestions = await completer(request.params.argument.value);
267 |     return createCompletionResult(suggestions);
268 |   }
269 | 
270 |   private _resourceHandlersInitialized = false;
271 | 
272 |   private setResourceRequestHandlers() {
273 |     if (this._resourceHandlersInitialized) {
274 |       return;
275 |     }
276 | 
277 |     this.server.assertCanSetRequestHandler(
278 |       ListResourcesRequestSchema.shape.method.value,
279 |     );
280 |     this.server.assertCanSetRequestHandler(
281 |       ListResourceTemplatesRequestSchema.shape.method.value,
282 |     );
283 |     this.server.assertCanSetRequestHandler(
284 |       ReadResourceRequestSchema.shape.method.value,
285 |     );
286 | 
287 |     this.server.registerCapabilities({
288 |       resources: {},
289 |     });
290 | 
291 |     this.server.setRequestHandler(
292 |       ListResourcesRequestSchema,
293 |       async (request, extra) => {
294 |         const resources = Object.entries(this._registeredResources).map(
295 |           ([uri, resource]) => ({
296 |             uri,
297 |             name: resource.name,
298 |             ...resource.metadata,
299 |           }),
300 |         );
301 | 
302 |         const templateResources: Resource[] = [];
303 |         for (const template of Object.values(
304 |           this._registeredResourceTemplates,
305 |         )) {
306 |           if (!template.resourceTemplate.listCallback) {
307 |             continue;
308 |           }
309 | 
310 |           const result = await template.resourceTemplate.listCallback(extra);
311 |           for (const resource of result.resources) {
312 |             templateResources.push({
313 |               ...resource,
314 |               ...template.metadata,
315 |             });
316 |           }
317 |         }
318 | 
319 |         return { resources: [...resources, ...templateResources] };
320 |       },
321 |     );
322 | 
323 |     this.server.setRequestHandler(
324 |       ListResourceTemplatesRequestSchema,
325 |       async () => {
326 |         const resourceTemplates = Object.entries(
327 |           this._registeredResourceTemplates,
328 |         ).map(([name, template]) => ({
329 |           name,
330 |           uriTemplate: template.resourceTemplate.uriTemplate.toString(),
331 |           ...template.metadata,
332 |         }));
333 | 
334 |         return { resourceTemplates };
335 |       },
336 |     );
337 | 
338 |     this.server.setRequestHandler(
339 |       ReadResourceRequestSchema,
340 |       async (request, extra) => {
341 |         const uri = new URL(request.params.uri);
342 | 
343 |         // First check for exact resource match
344 |         const resource = this._registeredResources[uri.toString()];
345 |         if (resource) {
346 |           return resource.readCallback(uri, extra);
347 |         }
348 | 
349 |         // Then check templates
350 |         for (const template of Object.values(
351 |           this._registeredResourceTemplates,
352 |         )) {
353 |           const variables = template.resourceTemplate.uriTemplate.match(
354 |             uri.toString(),
355 |           );
356 |           if (variables) {
357 |             return template.readCallback(uri, variables, extra);
358 |           }
359 |         }
360 | 
361 |         throw new McpError(
362 |           ErrorCode.InvalidParams,
363 |           `Resource ${uri} not found`,
364 |         );
365 |       },
366 |     );
367 | 
368 |     this.setCompletionRequestHandler();
369 |     
370 |     this._resourceHandlersInitialized = true;
371 |   }
372 | 
373 |   private _promptHandlersInitialized = false;
374 | 
375 |   private setPromptRequestHandlers() {
376 |     if (this._promptHandlersInitialized) {
377 |       return;
378 |     }
379 | 
380 |     this.server.assertCanSetRequestHandler(
381 |       ListPromptsRequestSchema.shape.method.value,
382 |     );
383 |     this.server.assertCanSetRequestHandler(
384 |       GetPromptRequestSchema.shape.method.value,
385 |     );
386 | 
387 |     this.server.registerCapabilities({
388 |       prompts: {},
389 |     });
390 | 
391 |     this.server.setRequestHandler(
392 |       ListPromptsRequestSchema,
393 |       (): ListPromptsResult => ({
394 |         prompts: Object.entries(this._registeredPrompts).map(
395 |           ([name, prompt]): Prompt => {
396 |             return {
397 |               name,
398 |               description: prompt.description,
399 |               arguments: prompt.argsSchema
400 |                 ? promptArgumentsFromSchema(prompt.argsSchema)
401 |                 : undefined,
402 |             };
403 |           },
404 |         ),
405 |       }),
406 |     );
407 | 
408 |     this.server.setRequestHandler(
409 |       GetPromptRequestSchema,
410 |       async (request, extra): Promise<GetPromptResult> => {
411 |         const prompt = this._registeredPrompts[request.params.name];
412 |         if (!prompt) {
413 |           throw new McpError(
414 |             ErrorCode.InvalidParams,
415 |             `Prompt ${request.params.name} not found`,
416 |           );
417 |         }
418 | 
419 |         if (prompt.argsSchema) {
420 |           const parseResult = await prompt.argsSchema.safeParseAsync(
421 |             request.params.arguments,
422 |           );
423 |           if (!parseResult.success) {
424 |             throw new McpError(
425 |               ErrorCode.InvalidParams,
426 |               `Invalid arguments for prompt ${request.params.name}: ${parseResult.error.message}`,
427 |             );
428 |           }
429 | 
430 |           const args = parseResult.data;
431 |           const cb = prompt.callback as PromptCallback<PromptArgsRawShape>;
432 |           return await Promise.resolve(cb(args, extra));
433 |         } else {
434 |           const cb = prompt.callback as PromptCallback<undefined>;
435 |           return await Promise.resolve(cb(extra));
436 |         }
437 |       },
438 |     );
439 | 
440 |     this.setCompletionRequestHandler();
441 |     
442 |     this._promptHandlersInitialized = true;
443 |   }
444 | 
445 |   /**
446 |    * Registers a resource `name` at a fixed URI, which will use the given callback to respond to read requests.
447 |    */
448 |   resource(name: string, uri: string, readCallback: ReadResourceCallback): void;
449 | 
450 |   /**
451 |    * Registers a resource `name` at a fixed URI with metadata, which will use the given callback to respond to read requests.
452 |    */
453 |   resource(
454 |     name: string,
455 |     uri: string,
456 |     metadata: ResourceMetadata,
457 |     readCallback: ReadResourceCallback,
458 |   ): void;
459 | 
460 |   /**
461 |    * Registers a resource `name` with a template pattern, which will use the given callback to respond to read requests.
462 |    */
463 |   resource(
464 |     name: string,
465 |     template: ResourceTemplate,
466 |     readCallback: ReadResourceTemplateCallback,
467 |   ): void;
468 | 
469 |   /**
470 |    * Registers a resource `name` with a template pattern and metadata, which will use the given callback to respond to read requests.
471 |    */
472 |   resource(
473 |     name: string,
474 |     template: ResourceTemplate,
475 |     metadata: ResourceMetadata,
476 |     readCallback: ReadResourceTemplateCallback,
477 |   ): void;
478 | 
479 |   resource(
480 |     name: string,
481 |     uriOrTemplate: string | ResourceTemplate,
482 |     ...rest: unknown[]
483 |   ): void {
484 |     let metadata: ResourceMetadata | undefined;
485 |     if (typeof rest[0] === "object") {
486 |       metadata = rest.shift() as ResourceMetadata;
487 |     }
488 | 
489 |     const readCallback = rest[0] as
490 |       | ReadResourceCallback
491 |       | ReadResourceTemplateCallback;
492 | 
493 |     if (typeof uriOrTemplate === "string") {
494 |       if (this._registeredResources[uriOrTemplate]) {
495 |         throw new Error(`Resource ${uriOrTemplate} is already registered`);
496 |       }
497 | 
498 |       this._registeredResources[uriOrTemplate] = {
499 |         name,
500 |         metadata,
501 |         readCallback: readCallback as ReadResourceCallback,
502 |       };
503 |     } else {
504 |       if (this._registeredResourceTemplates[name]) {
505 |         throw new Error(`Resource template ${name} is already registered`);
506 |       }
507 | 
508 |       this._registeredResourceTemplates[name] = {
509 |         resourceTemplate: uriOrTemplate,
510 |         metadata,
511 |         readCallback: readCallback as ReadResourceTemplateCallback,
512 |       };
513 |     }
514 | 
515 |     this.setResourceRequestHandlers();
516 |   }
517 | 
518 |   /**
519 |    * Registers a zero-argument tool `name`, which will run the given function when the client calls it.
520 |    */
521 |   tool(name: string, cb: ToolCallback): void;
522 | 
523 |   /**
524 |    * Registers a zero-argument tool `name` (with a description) which will run the given function when the client calls it.
525 |    */
526 |   tool(name: string, description: string, cb: ToolCallback): void;
527 | 
528 |   /**
529 |    * Registers a tool `name` accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
530 |    */
531 |   tool<Args extends ZodRawShape>(
532 |     name: string,
533 |     paramsSchema: Args,
534 |     cb: ToolCallback<Args>,
535 |   ): void;
536 | 
537 |   /**
538 |    * Registers a tool `name` (with a description) accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
539 |    */
540 |   tool<Args extends ZodRawShape>(
541 |     name: string,
542 |     description: string,
543 |     paramsSchema: Args,
544 |     cb: ToolCallback<Args>,
545 |   ): void;
546 | 
547 |   tool(name: string, ...rest: unknown[]): void {
548 |     if (this._registeredTools[name]) {
549 |       throw new Error(`Tool ${name} is already registered`);
550 |     }
551 | 
552 |     let description: string | undefined;
553 |     if (typeof rest[0] === "string") {
554 |       description = rest.shift() as string;
555 |     }
556 | 
557 |     let paramsSchema: ZodRawShape | undefined;
558 |     if (rest.length > 1) {
559 |       paramsSchema = rest.shift() as ZodRawShape;
560 |     }
561 | 
562 |     const cb = rest[0] as ToolCallback<ZodRawShape | undefined>;
563 |     this._registeredTools[name] = {
564 |       description,
565 |       inputSchema:
566 |         paramsSchema === undefined ? undefined : z.object(paramsSchema),
567 |       callback: cb,
568 |     };
569 | 
570 |     this.setToolRequestHandlers();
571 |   }
572 | 
573 |   /**
574 |    * Removes a registered tool by name.
575 |    * @param name - The name of the tool to remove.
576 |    * @returns boolean - Returns true if the tool was removed, false if the tool was not found.
577 |    */
578 |   removeTool(name: string): boolean {
579 |     if (this._registeredTools[name]) {
580 |       delete this._registeredTools[name];
581 |       return true;
582 |     }
583 |     return false;
584 |   }
585 | 
586 |   /**
587 |    * Registers a zero-argument prompt `name`, which will run the given function when the client calls it.
588 |    */
589 |   prompt(name: string, cb: PromptCallback): void;
590 | 
591 |   /**
592 |    * Registers a zero-argument prompt `name` (with a description) which will run the given function when the client calls it.
593 |    */
594 |   prompt(name: string, description: string, cb: PromptCallback): void;
595 | 
596 |   /**
597 |    * Registers a prompt `name` accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
598 |    */
599 |   prompt<Args extends PromptArgsRawShape>(
600 |     name: string,
601 |     argsSchema: Args,
602 |     cb: PromptCallback<Args>,
603 |   ): void;
604 | 
605 |   /**
606 |    * Registers a prompt `name` (with a description) accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
607 |    */
608 |   prompt<Args extends PromptArgsRawShape>(
609 |     name: string,
610 |     description: string,
611 |     argsSchema: Args,
612 |     cb: PromptCallback<Args>,
613 |   ): void;
614 | 
615 |   prompt(name: string, ...rest: unknown[]): void {
616 |     if (this._registeredPrompts[name]) {
617 |       throw new Error(`Prompt ${name} is already registered`);
618 |     }
619 | 
620 |     let description: string | undefined;
621 |     if (typeof rest[0] === "string") {
622 |       description = rest.shift() as string;
623 |     }
624 | 
625 |     let argsSchema: PromptArgsRawShape | undefined;
626 |     if (rest.length > 1) {
627 |       argsSchema = rest.shift() as PromptArgsRawShape;
628 |     }
629 | 
630 |     const cb = rest[0] as PromptCallback<PromptArgsRawShape | undefined>;
631 |     this._registeredPrompts[name] = {
632 |       description,
633 |       argsSchema: argsSchema === undefined ? undefined : z.object(argsSchema),
634 |       callback: cb,
635 |     };
636 | 
637 |     this.setPromptRequestHandlers();
638 |   }
639 | }
640 | 
641 | /**
642 |  * A callback to complete one variable within a resource template's URI template.
643 |  */
644 | export type CompleteResourceTemplateCallback = (
645 |   value: string,
646 | ) => string[] | Promise<string[]>;
647 | 
648 | /**
649 |  * A resource template combines a URI pattern with optional functionality to enumerate
650 |  * all resources matching that pattern.
651 |  */
652 | export class ResourceTemplate {
653 |   private _uriTemplate: UriTemplate;
654 | 
655 |   constructor(
656 |     uriTemplate: string | UriTemplate,
657 |     private _callbacks: {
658 |       /**
659 |        * A callback to list all resources matching this template. This is required to specified, even if `undefined`, to avoid accidentally forgetting resource listing.
660 |        */
661 |       list: ListResourcesCallback | undefined;
662 | 
663 |       /**
664 |        * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values.
665 |        */
666 |       complete?: {
667 |         [variable: string]: CompleteResourceTemplateCallback;
668 |       };
669 |     },
670 |   ) {
671 |     this._uriTemplate =
672 |       typeof uriTemplate === "string"
673 |         ? new UriTemplate(uriTemplate)
674 |         : uriTemplate;
675 |   }
676 | 
677 |   /**
678 |    * Gets the URI template pattern.
679 |    */
680 |   get uriTemplate(): UriTemplate {
681 |     return this._uriTemplate;
682 |   }
683 | 
684 |   /**
685 |    * Gets the list callback, if one was provided.
686 |    */
687 |   get listCallback(): ListResourcesCallback | undefined {
688 |     return this._callbacks.list;
689 |   }
690 | 
691 |   /**
692 |    * Gets the callback for completing a specific URI template variable, if one was provided.
693 |    */
694 |   completeCallback(
695 |     variable: string,
696 |   ): CompleteResourceTemplateCallback | undefined {
697 |     return this._callbacks.complete?.[variable];
698 |   }
699 | }
700 | 
701 | /**
702 |  * Callback for a tool handler registered with Server.tool().
703 |  *
704 |  * Parameters will include tool arguments, if applicable, as well as other request handler context.
705 |  */
706 | export type ToolCallback<Args extends undefined | ZodRawShape = undefined> =
707 |   Args extends ZodRawShape
708 |     ? (
709 |         args: z.objectOutputType<Args, ZodTypeAny>,
710 |         extra: RequestHandlerExtra,
711 |       ) => CallToolResult | Promise<CallToolResult>
712 |     : (extra: RequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
713 | 
714 | type RegisteredTool = {
715 |   description?: string;
716 |   inputSchema?: AnyZodObject;
717 |   callback: ToolCallback<undefined | ZodRawShape>;
718 | };
719 | 
720 | const EMPTY_OBJECT_JSON_SCHEMA = {
721 |   type: "object" as const,
722 | };
723 | 
724 | /**
725 |  * Additional, optional information for annotating a resource.
726 |  */
727 | export type ResourceMetadata = Omit<Resource, "uri" | "name">;
728 | 
729 | /**
730 |  * Callback to list all resources matching a given template.
731 |  */
732 | export type ListResourcesCallback = (
733 |   extra: RequestHandlerExtra,
734 | ) => ListResourcesResult | Promise<ListResourcesResult>;
735 | 
736 | /**
737 |  * Callback to read a resource at a given URI.
738 |  */
739 | export type ReadResourceCallback = (
740 |   uri: URL,
741 |   extra: RequestHandlerExtra,
742 | ) => ReadResourceResult | Promise<ReadResourceResult>;
743 | 
744 | type RegisteredResource = {
745 |   name: string;
746 |   metadata?: ResourceMetadata;
747 |   readCallback: ReadResourceCallback;
748 | };
749 | 
750 | /**
751 |  * Callback to read a resource at a given URI, following a filled-in URI template.
752 |  */
753 | export type ReadResourceTemplateCallback = (
754 |   uri: URL,
755 |   variables: Variables,
756 |   extra: RequestHandlerExtra,
757 | ) => ReadResourceResult | Promise<ReadResourceResult>;
758 | 
759 | type RegisteredResourceTemplate = {
760 |   resourceTemplate: ResourceTemplate;
761 |   metadata?: ResourceMetadata;
762 |   readCallback: ReadResourceTemplateCallback;
763 | };
764 | 
765 | type PromptArgsRawShape = {
766 |   [k: string]:
767 |     | ZodType<string, ZodTypeDef, string>
768 |     | ZodOptional<ZodType<string, ZodTypeDef, string>>;
769 | };
770 | 
771 | export type PromptCallback<
772 |   Args extends undefined | PromptArgsRawShape = undefined,
773 | > = Args extends PromptArgsRawShape
774 |   ? (
775 |       args: z.objectOutputType<Args, ZodTypeAny>,
776 |       extra: RequestHandlerExtra,
777 |     ) => GetPromptResult | Promise<GetPromptResult>
778 |   : (extra: RequestHandlerExtra) => GetPromptResult | Promise<GetPromptResult>;
779 | 
780 | type RegisteredPrompt = {
781 |   description?: string;
782 |   argsSchema?: ZodObject<PromptArgsRawShape>;
783 |   callback: PromptCallback<undefined | PromptArgsRawShape>;
784 | };
785 | 
786 | function promptArgumentsFromSchema(
787 |   schema: ZodObject<PromptArgsRawShape>,
788 | ): PromptArgument[] {
789 |   return Object.entries(schema.shape).map(
790 |     ([name, field]): PromptArgument => ({
791 |       name,
792 |       description: field.description,
793 |       required: !field.isOptional(),
794 |     }),
795 |   );
796 | }
797 | 
798 | function createCompletionResult(suggestions: string[]): CompleteResult {
799 |   return {
800 |     completion: {
801 |       values: suggestions.slice(0, 100),
802 |       total: suggestions.length,
803 |       hasMore: suggestions.length > 100,
804 |     },
805 |   };
806 | }
807 | 
808 | const EMPTY_COMPLETION_RESULT: CompleteResult = {
809 |   completion: {
810 |     values: [],
811 |     hasMore: false,
812 |   },
813 | };
814 | 
```
Page 3/13FirstPrevNextLast