roadmap-skill 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
4
  var __esm = (fn, res) => function __init() {
@@ -79,6 +80,7 @@ import {
79
80
  GetPromptRequestSchema
80
81
  } from "@modelcontextprotocol/sdk/types.js";
81
82
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
83
+ import { zodToJsonSchema } from "zod-to-json-schema";
82
84
 
83
85
  // src/tools/index.ts
84
86
  init_esm_shims();
@@ -704,12 +706,13 @@ var batchUpdateTasksTool = {
704
706
  const existingTask = projectData.tasks[taskIndex];
705
707
  let updatedTags = existingTask.tags;
706
708
  if (input.tags && input.tags.length > 0) {
709
+ const existingTags = existingTask.tags || [];
707
710
  switch (input.tagOperation) {
708
711
  case "add":
709
- updatedTags = [.../* @__PURE__ */ new Set([...existingTask.tags, ...input.tags])];
712
+ updatedTags = [.../* @__PURE__ */ new Set([...existingTags, ...input.tags])];
710
713
  break;
711
714
  case "remove":
712
- updatedTags = existingTask.tags.filter((tag) => !input.tags.includes(tag));
715
+ updatedTags = existingTags.filter((tag) => !input.tags.includes(tag));
713
716
  break;
714
717
  case "replace":
715
718
  default:
@@ -1016,9 +1019,6 @@ init_esm_shims();
1016
1019
  init_esm_shims();
1017
1020
  import express from "express";
1018
1021
  import * as path4 from "path";
1019
- import { fileURLToPath as fileURLToPath2 } from "url";
1020
- var __filename2 = fileURLToPath2(import.meta.url);
1021
- var __dirname2 = path4.dirname(__filename2);
1022
1022
  function createServer(port = 7860) {
1023
1023
  const app = express();
1024
1024
  app.use(express.json());
@@ -1166,7 +1166,7 @@ function createServer(port = 7860) {
1166
1166
  res.status(500).json({ error: error.message });
1167
1167
  }
1168
1168
  });
1169
- const distPath = path4.join(__dirname2, "app");
1169
+ const distPath = path4.join(process.cwd(), "dist", "web", "app");
1170
1170
  app.use(express.static(distPath));
1171
1171
  app.get("*", (req, res) => {
1172
1172
  if (req.path.startsWith("/api")) {
@@ -1182,7 +1182,15 @@ function createServer(port = 7860) {
1182
1182
  }
1183
1183
 
1184
1184
  // src/tools/web-tools.ts
1185
+ import open from "open";
1185
1186
  var activeServer = null;
1187
+ async function openBrowser(url) {
1188
+ try {
1189
+ await open(url);
1190
+ } catch (error) {
1191
+ console.error("Failed to open browser:", error);
1192
+ }
1193
+ }
1186
1194
  var openWebInterfaceTool = {
1187
1195
  name: "open_web_interface",
1188
1196
  description: "Open web visualization interface",
@@ -1204,15 +1212,21 @@ var openWebInterfaceTool = {
1204
1212
  }
1205
1213
  const port = args.port || 7860;
1206
1214
  activeServer = createServer(port);
1215
+ const url = `http://localhost:${port}`;
1216
+ void openBrowser(url);
1207
1217
  return {
1208
- message: "Web interface started successfully",
1209
- url: `http://localhost:${port}`
1218
+ message: "Web interface started successfully and opened in browser",
1219
+ url
1210
1220
  };
1211
1221
  }
1212
1222
  };
1213
1223
  var closeWebInterfaceTool = {
1214
1224
  name: "close_web_interface",
1215
1225
  description: "Close web visualization interface",
1226
+ parameters: {
1227
+ type: "object",
1228
+ properties: {}
1229
+ },
1216
1230
  async execute() {
1217
1231
  if (!activeServer) {
1218
1232
  return { message: "Web interface is not running" };
@@ -1635,412 +1649,335 @@ init_esm_shims();
1635
1649
  init_esm_shims();
1636
1650
  var projectPrompts = [
1637
1651
  {
1638
- name: "projectPlanningPrompt",
1639
- description: "Helps users plan a new project with structured guidance",
1652
+ name: "recommendNextTasks",
1653
+ description: "\u667A\u80FD\u63A8\u8350\u63A5\u4E0B\u6765\u8981\u5B8C\u6210\u7684\u4F18\u5148\u4EFB\u52A1\uFF0C\u57FA\u4E8E\u4F18\u5148\u7EA7\u3001\u622A\u6B62\u65E5\u671F\u548C\u9879\u76EE\u72B6\u6001",
1640
1654
  arguments: [
1641
1655
  {
1642
- name: "projectType",
1643
- description: "Type of project (roadmap, skill-tree, kanban)",
1656
+ name: "projectId",
1657
+ description: "\u7279\u5B9A\u9879\u76EE\u7684ID\uFF08\u53EF\u9009\uFF0C\u4E0D\u63D0\u4F9B\u5219\u5206\u6790\u6240\u6709\u9879\u76EE\uFF09",
1658
+ required: false
1659
+ },
1660
+ {
1661
+ name: "limit",
1662
+ description: "\u63A8\u8350\u4EFB\u52A1\u6570\u91CF\uFF08\u9ED8\u8BA43\u4E2A\uFF09",
1644
1663
  required: false
1645
1664
  }
1646
1665
  ]
1647
1666
  },
1648
1667
  {
1649
- name: "taskManagementPrompt",
1650
- description: "Helps users manage and organize tasks effectively",
1668
+ name: "autoPrioritize",
1669
+ description: "\u81EA\u52A8\u5206\u6790\u4EFB\u52A1\u5E76\u667A\u80FD\u8C03\u6574\u4F18\u5148\u7EA7\uFF0C\u8003\u8651\u622A\u6B62\u65E5\u671F\u3001\u4EFB\u52A1\u4F9D\u8D56\u548C\u9879\u76EE\u91CD\u8981\u6027",
1651
1670
  arguments: [
1652
1671
  {
1653
1672
  name: "projectId",
1654
- description: "ID of the project to manage tasks for",
1673
+ description: "\u7279\u5B9A\u9879\u76EE\u7684ID\uFF08\u53EF\u9009\uFF0C\u4E0D\u63D0\u4F9B\u5219\u5206\u6790\u6240\u6709\u9879\u76EE\uFF09",
1655
1674
  required: false
1656
1675
  }
1657
1676
  ]
1658
1677
  },
1659
1678
  {
1660
- name: "roadmapOverviewPrompt",
1661
- description: "Shows a comprehensive overview of the roadmap",
1662
- arguments: []
1679
+ name: "enhanceTaskDetails",
1680
+ description: "\u667A\u80FD\u8865\u5145\u4EFB\u52A1\u7EC6\u8282\uFF0C\u5305\u62EC\u63CF\u8FF0\u3001\u9A8C\u6536\u6807\u51C6\u3001\u5B50\u4EFB\u52A1\u548C\u6240\u9700\u8D44\u6E90",
1681
+ arguments: [
1682
+ {
1683
+ name: "taskId",
1684
+ description: "\u8981\u5B8C\u5584\u7684\u4EFB\u52A1ID",
1685
+ required: true
1686
+ }
1687
+ ]
1663
1688
  },
1664
1689
  {
1665
- name: "milestoneReviewPrompt",
1666
- description: "Helps review and evaluate project milestones",
1690
+ name: "quickCapture",
1691
+ description: "\u5FEB\u901F\u6355\u6349\u60F3\u6CD5/\u4EFB\u52A1\uFF0C\u81EA\u52A8\u5206\u7C7B\u5E76\u5EFA\u8BAE\u4F18\u5148\u7EA7",
1667
1692
  arguments: [
1693
+ {
1694
+ name: "idea",
1695
+ description: "\u8981\u6355\u6349\u7684\u60F3\u6CD5\u6216\u4EFB\u52A1\u63CF\u8FF0",
1696
+ required: true
1697
+ },
1668
1698
  {
1669
1699
  name: "projectId",
1670
- description: "ID of the project to review milestones for",
1700
+ description: "\u76EE\u6807\u9879\u76EEID\uFF08\u53EF\u9009\uFF09",
1671
1701
  required: false
1672
1702
  }
1673
1703
  ]
1674
1704
  }
1675
1705
  ];
1676
- function getProjectPlanningPrompt(projectType) {
1677
- const typeContext = projectType ? `You are planning a ${projectType} project.` : "You are planning a new project.";
1706
+ function getRecommendNextTasksPrompt(projectId, limit) {
1707
+ const context = projectId ? `\u5206\u6790\u9879\u76EE ${projectId} \u7684\u4EFB\u52A1` : "\u5206\u6790\u6240\u6709\u6D3B\u8DC3\u9879\u76EE\u7684\u4EFB\u52A1";
1708
+ const taskLimit = limit ? parseInt(limit, 10) : 3;
1678
1709
  return {
1679
- description: "Project Planning Assistant",
1710
+ description: "\u667A\u80FD\u4EFB\u52A1\u63A8\u8350\u52A9\u624B",
1680
1711
  messages: [
1681
1712
  {
1682
1713
  role: "user",
1683
1714
  content: {
1684
1715
  type: "text",
1685
- text: `${typeContext}
1686
-
1687
- I will help you plan your project step by step. Let's start by defining the key aspects:
1688
-
1689
- ## Step 1: Project Definition
1690
- - What is the name of your project?
1691
- - What is the main goal or objective?
1692
- - Who is the target audience or beneficiary?
1693
-
1694
- ## Step 2: Scope and Timeline
1695
- - What are the start and target completion dates?
1696
- - What are the major deliverables?
1697
- - What is explicitly out of scope?
1698
-
1699
- ## Step 3: Key Milestones
1700
- Identify 3-5 major milestones that mark significant progress:
1701
- - Milestone 1: [Name] - Target Date
1702
- - Milestone 2: [Name] - Target Date
1703
- - Milestone 3: [Name] - Target Date
1704
-
1705
- ## Step 4: Initial Tasks
1706
- List the first 5-10 tasks to get started:
1707
- - Task name and brief description
1708
- - Priority level (low, medium, high, critical)
1709
- - Estimated completion time
1710
-
1711
- ## Step 5: Resources and Tags
1712
- - What categories or tags will help organize this project?
1713
- - Are there any specific resources, tools, or people needed?
1714
-
1715
- ## Example
1716
- Here's a simple example for a "Learn TypeScript" skill-tree project:
1717
-
1718
- **Project**: TypeScript Mastery
1719
- **Goal**: Become proficient in TypeScript for web development
1720
- **Timeline**: 3 months (Jan 1 - Mar 31)
1721
-
1722
- **Milestones**:
1723
- 1. Complete basic syntax (Week 2)
1724
- 2. Build first TypeScript app (Week 6)
1725
- 3. Master advanced types (Week 10)
1726
- 4. Complete final project (Week 12)
1727
-
1728
- **Initial Tasks**:
1729
- 1. Set up TypeScript environment (high priority)
1730
- 2. Complete "Hello World" tutorial (medium priority)
1731
- 3. Study type annotations (high priority)
1732
- 4. Practice with interfaces (medium priority)
1733
-
1734
- Please share your project details, and I'll help you refine the plan!`
1716
+ text: `${context}\uFF0C\u8BF7\u5E2E\u6211\u63A8\u8350\u63A5\u4E0B\u6765\u5E94\u8BE5\u4F18\u5148\u5B8C\u6210\u7684${taskLimit}\u4E2A\u4EFB\u52A1\u3002
1717
+
1718
+ ## \u63A8\u8350\u903B\u8F91\uFF08\u6309\u4F18\u5148\u7EA7\u6392\u5E8F\uFF09\uFF1A
1719
+
1720
+ ### 1. \u7D27\u6025\u4E14\u91CD\u8981\uFF08Critical\u4F18\u5148\u7EA7 + \u622A\u6B62\u65E5\u671F\u8FD1\uFF09
1721
+ - \u4ECA\u5929\u6216\u660E\u5929\u5230\u671F\u7684Critical\u4EFB\u52A1
1722
+ - \u5DF2\u903E\u671F\u7684\u9AD8\u4F18\u5148\u7EA7\u4EFB\u52A1
1723
+
1724
+ ### 2. \u9AD8\u4EF7\u503C\u4EFB\u52A1\uFF08High\u4F18\u5148\u7EA7 + \u6709\u660E\u786E\u622A\u6B62\u65E5\u671F\uFF09
1725
+ - \u672C\u5468\u5185\u5230\u671F\u7684High\u4F18\u5148\u7EA7\u4EFB\u52A1
1726
+ - \u963B\u585E\u5176\u4ED6\u4EFB\u52A1\u7684\u5173\u952E\u8DEF\u5F84\u4EFB\u52A1
1727
+
1728
+ ### 3. \u5FEB\u901F\u83B7\u80DC\uFF08Medium\u4F18\u5148\u7EA7 + \u9884\u8BA1\u8017\u65F6\u77ED\uFF09
1729
+ - \u53EF\u4EE5\u57281-2\u5C0F\u65F6\u5185\u5B8C\u6210\u7684Medium\u4EFB\u52A1
1730
+ - \u80FD\u660E\u663E\u63D0\u5347\u9879\u76EE\u8FDB\u5EA6\u7684\u4EFB\u52A1
1731
+
1732
+ ### 4. \u8BA1\u5212\u5185\u5DE5\u4F5C
1733
+ - \u5DF2\u6807\u8BB0\u4E3A"in-progress"\u4F46\u672A\u5B8C\u6210\u7684\u4EFB\u52A1
1734
+ - \u5373\u5C06\u5230\u671F\u7684Normal\u4F18\u5148\u7EA7\u4EFB\u52A1
1735
+
1736
+ ## \u8BF7\u6267\u884C\u4EE5\u4E0B\u6B65\u9AA4\uFF1A
1737
+
1738
+ 1. **\u5217\u51FA\u6240\u6709\u5F85\u529E\u4EFB\u52A1**\uFF08status = todo \u6216 in-progress\uFF09
1739
+ 2. **\u7B5B\u9009\u51FA\u9AD8\u4F18\u5148\u7EA7\u4EFB\u52A1**\uFF1Acritical \u548C high
1740
+ 3. **\u68C0\u67E5\u622A\u6B62\u65E5\u671F**\uFF1A\u627E\u51FA\u5373\u5C06\u5230\u671F\u6216\u5DF2\u903E\u671F\u7684\u4EFB\u52A1
1741
+ 4. **\u5206\u6790\u963B\u585E\u5173\u7CFB**\uFF1A\u8BC6\u522B\u54EA\u4E9B\u4EFB\u52A1\u963B\u585E\u4E86\u5176\u4ED6\u4EFB\u52A1
1742
+ 5. **\u751F\u6210\u63A8\u8350\u5217\u8868**\uFF1A\u7ED9\u51FA${taskLimit}\u4E2A\u6700\u5E94\u8BE5\u4F18\u5148\u5904\u7406\u7684\u4EFB\u52A1\uFF0C\u5305\u542B\u7406\u7531
1743
+
1744
+ ## \u8F93\u51FA\u683C\u5F0F\uFF1A
1745
+
1746
+ ### \u7ACB\u5373\u5904\u7406\uFF08Critical\uFF09
1747
+ 1. **\u4EFB\u52A1\u540D** (\u9879\u76EE\u540D)
1748
+ - \u539F\u56E0\uFF1A[\u4E3A\u4EC0\u4E48\u8FD9\u4E2A\u4EFB\u52A1\u6700\u7D27\u6025]
1749
+ - \u5EFA\u8BAE\u884C\u52A8\uFF1A[\u5177\u4F53\u505A\u4EC0\u4E48]
1750
+
1751
+ ### \u4ECA\u65E5\u91CD\u70B9\uFF08High\uFF09
1752
+ 2. **\u4EFB\u52A1\u540D** (\u9879\u76EE\u540D)
1753
+ - \u539F\u56E0\uFF1A[\u4E3A\u4EC0\u4E48\u8FD9\u4E2A\u4EFB\u52A1\u91CD\u8981]
1754
+ - \u5EFA\u8BAE\u884C\u52A8\uFF1A[\u5177\u4F53\u505A\u4EC0\u4E48]
1755
+
1756
+ ### \u540E\u7EED\u8DDF\u8FDB
1757
+ 3. **\u4EFB\u52A1\u540D** (\u9879\u76EE\u540D)
1758
+ - \u539F\u56E0\uFF1A[\u4E3A\u4EC0\u4E48\u5E94\u8BE5\u63A5\u4E0B\u6765\u505A]
1759
+ - \u5EFA\u8BAE\u884C\u52A8\uFF1A[\u5177\u4F53\u505A\u4EC0\u4E48]
1760
+
1761
+ \u8BF7\u4F7F\u7528 list_tasks \u5DE5\u5177\u83B7\u53D6\u4EFB\u52A1\u6570\u636E\uFF0C\u7136\u540E\u7ED9\u51FA\u667A\u80FD\u63A8\u8350\u3002
1762
+
1763
+ ## Important Reminder
1764
+ When you start working on recommended tasks, please:
1765
+ 1. Use update_task to set task status to in-progress
1766
+ 2. After completing the task, use update_task to set status to done
1767
+ 3. If blocked or have issues, document in description and update status to review
1768
+
1769
+ Keep task status synchronized with actual progress!`
1735
1770
  }
1736
1771
  }
1737
1772
  ]
1738
1773
  };
1739
1774
  }
1740
- function getTaskManagementPrompt(projectId) {
1741
- const projectContext = projectId ? `Managing tasks for project: ${projectId}` : "Managing tasks across all projects";
1775
+ function getAutoPrioritizePrompt(projectId) {
1776
+ const context = projectId ? `\u5206\u6790\u9879\u76EE ${projectId} \u7684\u4EFB\u52A1\u4F18\u5148\u7EA7` : "\u5206\u6790\u6240\u6709\u9879\u76EE\u7684\u4EFB\u52A1\u4F18\u5148\u7EA7";
1742
1777
  return {
1743
- description: "Task Management Assistant",
1778
+ description: "\u667A\u80FD\u4F18\u5148\u7EA7\u4F18\u5316\u52A9\u624B",
1744
1779
  messages: [
1745
1780
  {
1746
1781
  role: "user",
1747
1782
  content: {
1748
1783
  type: "text",
1749
- text: `${projectContext}
1750
-
1751
- I'll help you manage your tasks effectively. Here are the key areas we can work on:
1752
-
1753
- ## Task Organization
1754
-
1755
- ### Current Status Review
1756
- Let's review tasks by status:
1757
- - **Todo**: Tasks waiting to be started
1758
- - **In Progress**: Tasks currently being worked on
1759
- - **Review**: Tasks completed and awaiting review
1760
- - **Done**: Completed tasks
1761
-
1762
- ### Priority Management
1763
- Tasks should be prioritized as:
1764
- - **Critical**: Blockers, urgent deadlines, essential functionality
1765
- - **High**: Important features, near-term deadlines
1766
- - **Medium**: Standard work, nice-to-have features
1767
- - **Low**: Backlog items, future improvements
1768
-
1769
- ## Task Actions
1770
-
1771
- ### Creating New Tasks
1772
- When creating a task, include:
1773
- - Clear, actionable title
1774
- - Detailed description with acceptance criteria
1775
- - Priority level
1776
- - Due date (if applicable)
1777
- - Assignee (if applicable)
1778
- - Relevant tags
1779
-
1780
- ### Updating Tasks
1781
- Common updates include:
1782
- - Status changes (todo \u2192 in progress \u2192 review \u2192 done)
1783
- - Priority adjustments
1784
- - Due date modifications
1785
- - Adding comments or notes
1786
-
1787
- ### Batch Operations
1788
- You can perform actions on multiple tasks:
1789
- - Update status for multiple tasks
1790
- - Reassign tasks
1791
- - Apply tags to multiple tasks
1792
-
1793
- ## Best Practices
1794
-
1795
- 1. **Keep tasks small**: Break large work into manageable pieces
1796
- 2. **Write clear titles**: Use action verbs (e.g., "Implement", "Fix", "Update")
1797
- 3. **Set realistic due dates**: Account for dependencies and blockers
1798
- 4. **Review regularly**: Check overdue tasks and adjust priorities
1799
- 5. **Use tags consistently**: Create a tagging convention and stick to it
1800
-
1801
- ## Example Workflow
1802
-
1803
- **Morning Routine**:
1804
- 1. Review overdue tasks
1805
- 2. Check what's in progress
1806
- 3. Prioritize today's work
1807
- 4. Update task statuses
1808
-
1809
- **Weekly Review**:
1810
- 1. Review completed tasks
1811
- 2. Assess progress toward milestones
1812
- 3. Reprioritize upcoming work
1813
- 4. Identify blockers
1814
-
1815
- What would you like to work on? You can:
1816
- - View tasks by status
1817
- - Create new tasks
1818
- - Update existing tasks
1819
- - Search for specific tasks
1820
- - Get an overview of task distribution`
1784
+ text: `${context}\uFF0C\u8BF7\u81EA\u52A8\u5206\u6790\u5E76\u5EFA\u8BAE\u4F18\u5148\u7EA7\u8C03\u6574\u3002
1785
+
1786
+ ## \u4F18\u5148\u7EA7\u8C03\u6574\u89C4\u5219\uFF1A
1787
+
1788
+ ### \u5347\u7EA7\u4E3A Critical \u7684\u6761\u4EF6\uFF1A
1789
+ - [ ] \u622A\u6B62\u65E5\u671F\u572848\u5C0F\u65F6\u5185\u4E14\u672A\u5B8C\u6210
1790
+ - [ ] \u963B\u585E\u4E86\u5176\u4ED6high/critical\u4EFB\u52A1
1791
+ - [ ] \u662F\u9879\u76EE\u5173\u952E\u8DEF\u5F84\u4E0A\u7684\u4EFB\u52A1\u4E14\u8FDB\u5EA6\u843D\u540E
1792
+ - [ ] \u6709\u5916\u90E8\u4F9D\u8D56\uFF08\u5982\u5BA2\u6237\u3001\u5408\u4F5C\u65B9\uFF09\u4E14\u65F6\u95F4\u7D27\u8FEB
1793
+
1794
+ ### \u5347\u7EA7\u4E3A High \u7684\u6761\u4EF6\uFF1A
1795
+ - [ ] \u622A\u6B62\u65E5\u671F\u57281\u5468\u5185
1796
+ - [ ] \u662F\u91CD\u8981\u91CC\u7A0B\u7891\u7684\u524D\u7F6E\u4EFB\u52A1
1797
+ - [ ] \u957F\u671F\u5361\u5728"in-progress"\u72B6\u6001\uFF08\u8D85\u8FC73\u5929\uFF09
1798
+ - [ ] \u5F71\u54CD\u591A\u4E2A\u56E2\u961F\u6210\u5458\u7684\u5DE5\u4F5C
1799
+
1800
+ ### \u964D\u7EA7\u4E3A Medium/Low \u7684\u6761\u4EF6\uFF1A
1801
+ - [ ] \u622A\u6B62\u65E5\u671F\u8FD8\u5F88\u8FDC\uFF08>2\u5468\uFF09\u4E14\u6CA1\u6709\u4F9D\u8D56
1802
+ - [ ] \u662F"nice to have"\u529F\u80FD\u800C\u975E\u6838\u5FC3\u529F\u80FD
1803
+ - [ ] \u5F53\u524D\u9636\u6BB5\u4E0D\u9700\u8981\uFF0C\u53EF\u4EE5\u5EF6\u540E
1804
+
1805
+ ### \u5176\u4ED6\u8003\u8651\u56E0\u7D20\uFF1A
1806
+ - **\u9879\u76EE\u6574\u4F53\u8FDB\u5EA6**\uFF1A\u8FDB\u5EA6\u843D\u540E\u7684\u9879\u76EE\u4EFB\u52A1\u5E94\u63D0\u5347\u4F18\u5148\u7EA7
1807
+ - **\u8D44\u6E90\u53EF\u7528\u6027**\uFF1A\u5982\u679C\u8D44\u6E90\u7D27\u5F20\uFF0C\u805A\u7126\u6700\u9AD8\u4F18\u5148\u7EA7
1808
+ - **\u98CE\u9669\u56E0\u7D20**\uFF1A\u98CE\u9669\u9AD8\u7684\u4EFB\u52A1\u5E94\u63D0\u524D\u5904\u7406
1809
+
1810
+ ## \u8BF7\u6267\u884C\u4EE5\u4E0B\u6B65\u9AA4\uFF1A
1811
+
1812
+ 1. **\u83B7\u53D6\u6240\u6709\u4EFB\u52A1**\uFF1A\u4F7F\u7528 list_tasks \u83B7\u53D6\u4EFB\u52A1\u5217\u8868
1813
+ 2. **\u5206\u6790\u6BCF\u4E2A\u4EFB\u52A1**\uFF1A
1814
+ - \u68C0\u67E5\u622A\u6B62\u65E5\u671F\u4E0E\u5F53\u524D\u65E5\u671F\u7684\u5DEE\u8DDD
1815
+ - \u8BC6\u522B\u4EFB\u52A1\u4F9D\u8D56\u5173\u7CFB
1816
+ - \u8BC4\u4F30\u9879\u76EE\u6574\u4F53\u5065\u5EB7\u5EA6
1817
+ 3. **\u751F\u6210\u8C03\u6574\u5EFA\u8BAE**\uFF1A\u5217\u51FA\u9700\u8981\u8C03\u6574\u4F18\u5148\u7EA7\u7684\u4EFB\u52A1\u53CA\u7406\u7531
1818
+ 4. **\u6279\u91CF\u66F4\u65B0**\uFF1A\u4F7F\u7528 batch_update_tasks \u6267\u884C\u4F18\u5148\u7EA7\u8C03\u6574
1819
+
1820
+ ## \u8F93\u51FA\u683C\u5F0F\uFF1A
1821
+
1822
+ ### \u5EFA\u8BAE\u5347\u7EA7\u4E3A Critical
1823
+ | \u4EFB\u52A1 | \u5F53\u524D\u4F18\u5148\u7EA7 | \u5EFA\u8BAE\u4F18\u5148\u7EA7 | \u7406\u7531 |
1824
+ |------|-----------|-----------|------|
1825
+ | XXX | high \u2192 critical | \u660E\u5929\u5230\u671F |
1826
+
1827
+ ### \u5EFA\u8BAE\u5347\u7EA7\u4E3A High
1828
+ | \u4EFB\u52A1 | \u5F53\u524D\u4F18\u5148\u7EA7 | \u5EFA\u8BAE\u4F18\u5148\u7EA7 | \u7406\u7531 |
1829
+ |------|-----------|-----------|------|
1830
+ | XXX | medium \u2192 high | \u963B\u585E\u540E\u7EED\u4EFB\u52A1 |
1831
+
1832
+ ### \u5EFA\u8BAE\u964D\u7EA7
1833
+ | \u4EFB\u52A1 | \u5F53\u524D\u4F18\u5148\u7EA7 | \u5EFA\u8BAE\u4F18\u5148\u7EA7 | \u7406\u7531 |
1834
+ |------|-----------|-----------|------|
1835
+ | XXX | high \u2192 medium | \u53EF\u5EF6\u540E\u5904\u7406 |
1836
+
1837
+ ### \u4FDD\u6301\u4E0D\u53D8\uFF08\u4F18\u5148\u7EA7\u5408\u7406\uFF09
1838
+ - \u5217\u51FA\u4F18\u5148\u7EA7\u8BBE\u7F6E\u5408\u7406\u7684\u4EFB\u52A1
1839
+
1840
+ \u8BF7\u7ED9\u51FA\u5206\u6790\u7ED3\u679C\uFF0C\u5E76\u5728\u7528\u6237\u786E\u8BA4\u540E\u6267\u884C\u6279\u91CF\u66F4\u65B0\u3002`
1821
1841
  }
1822
1842
  }
1823
1843
  ]
1824
1844
  };
1825
1845
  }
1826
- function getRoadmapOverviewPrompt() {
1846
+ function getEnhanceTaskDetailsPrompt(taskId) {
1827
1847
  return {
1828
- description: "Roadmap Overview Assistant",
1848
+ description: "\u4EFB\u52A1\u7EC6\u8282\u5B8C\u5584\u52A9\u624B",
1829
1849
  messages: [
1830
1850
  {
1831
1851
  role: "user",
1832
1852
  content: {
1833
1853
  type: "text",
1834
- text: `Welcome to your Roadmap Overview!
1835
-
1836
- I'll help you get a comprehensive view of all your projects and their progress. Here's what we can explore:
1837
-
1838
- ## Dashboard Overview
1839
-
1840
- ### Project Summary
1841
- - Total number of projects
1842
- - Projects by status (active, completed, archived)
1843
- - Projects by type (roadmap, skill-tree, kanban)
1844
- - Recently updated projects
1845
-
1846
- ### Task Overview
1847
- - Total tasks across all projects
1848
- - Tasks by status (todo, in progress, review, done)
1849
- - Overdue tasks requiring attention
1850
- - Tasks by priority level
1851
-
1852
- ### Progress Metrics
1853
- - Overall completion percentage
1854
- - Milestones completed vs. total
1855
- - Average tasks per project
1856
- - Upcoming deadlines
1857
-
1858
- ## Project Health Indicators
1859
-
1860
- ### Green (Healthy)
1861
- - On track with timeline
1862
- - No overdue critical tasks
1863
- - Regular progress being made
1864
-
1865
- ### Yellow (Attention Needed)
1866
- - Some tasks overdue but not critical
1867
- - Approaching deadline
1868
- - Tasks stuck in review
1854
+ text: `\u8BF7\u5E2E\u6211\u5B8C\u5584\u4EFB\u52A1 ${taskId} \u7684\u7EC6\u8282\u3002
1855
+
1856
+ ## \u5B8C\u5584\u5185\u5BB9\uFF1A
1857
+
1858
+ ### 1. \u8BE6\u7EC6\u63CF\u8FF0
1859
+ - \u4EFB\u52A1\u7684\u5177\u4F53\u5185\u5BB9\u548C\u80CC\u666F
1860
+ - \u4E3A\u4EC0\u4E48\u8981\u505A\u8FD9\u4E2A\u4EFB\u52A1
1861
+ - \u9884\u671F\u7684\u4E1A\u52A1\u4EF7\u503C\u6216\u6280\u672F\u4EF7\u503C
1862
+
1863
+ ### 2. \u9A8C\u6536\u6807\u51C6\uFF08Definition of Done\uFF09
1864
+ \u5217\u51FA\u660E\u786E\u7684\u5B8C\u6210\u6807\u51C6\uFF0C\u4F8B\u5982\uFF1A
1865
+ - [ ] \u529F\u80FD\u5B9E\u73B0\u5E76\u672C\u5730\u6D4B\u8BD5\u901A\u8FC7
1866
+ - [ ] \u4EE3\u7801\u901A\u8FC7Code Review
1867
+ - [ ] \u76F8\u5173\u6587\u6863\u5DF2\u66F4\u65B0
1868
+ - [ ] \u5355\u5143\u6D4B\u8BD5\u8986\u76D6\u7387>80%
1869
+
1870
+ ### 3. \u6280\u672F/\u5B9E\u73B0\u7EC6\u8282
1871
+ - \u6D89\u53CA\u7684\u6280\u672F\u6808\u6216\u6A21\u5757
1872
+ - \u53EF\u80FD\u9700\u8981\u4FEE\u6539\u7684\u6587\u4EF6
1873
+ - \u6F5C\u5728\u7684\u6311\u6218\u6216\u6CE8\u610F\u4E8B\u9879
1874
+
1875
+ ### 4. \u76F8\u5173\u8D44\u6E90
1876
+ - \u76F8\u5173\u6587\u6863\u94FE\u63A5
1877
+ - \u53C2\u8003\u5B9E\u73B0\u6216\u793A\u4F8B\u4EE3\u7801
1878
+ - \u9700\u8981\u54A8\u8BE2\u7684\u4EBA\u5458
1879
+
1880
+ ### 5. \u5B50\u4EFB\u52A1\u5EFA\u8BAE\uFF08\u5982\u679C\u9700\u8981\uFF09
1881
+ \u5982\u679C\u4EFB\u52A1\u8F83\u590D\u6742\uFF0C\u5EFA\u8BAE\u62C6\u5206\u4E3A\u5B50\u4EFB\u52A1\uFF1A
1882
+ - \u5B50\u4EFB\u52A11\uFF1A...
1883
+ - \u5B50\u4EFB\u52A12\uFF1A...
1884
+ - \u5B50\u4EFB\u52A13\uFF1A...
1885
+
1886
+ ## \u8BF7\u6267\u884C\u4EE5\u4E0B\u6B65\u9AA4\uFF1A
1887
+
1888
+ 1. **\u83B7\u53D6\u4EFB\u52A1\u4FE1\u606F**\uFF1A\u4F7F\u7528 get_task \u67E5\u770B\u5F53\u524D\u4EFB\u52A1\u8BE6\u60C5
1889
+ 2. **\u83B7\u53D6\u9879\u76EE\u4E0A\u4E0B\u6587**\uFF1A\u4F7F\u7528 get_project \u4E86\u89E3\u9879\u76EE\u80CC\u666F
1890
+ 3. **\u5206\u6790\u4EFB\u52A1\u7C7B\u578B**\uFF1A
1891
+ - \u5982\u679C\u662F\u5F00\u53D1\u4EFB\u52A1\uFF1A\u8865\u5145\u6280\u672F\u7EC6\u8282\u3001\u4EE3\u7801\u4F4D\u7F6E
1892
+ - \u5982\u679C\u662F\u8BBE\u8BA1\u4EFB\u52A1\uFF1A\u8865\u5145\u8BBE\u8BA1\u89C4\u8303\u3001\u8BC4\u5BA1\u6807\u51C6
1893
+ - \u5982\u679C\u662F\u6587\u6863\u4EFB\u52A1\uFF1A\u8865\u5145\u6587\u6863\u7ED3\u6784\u3001\u53C2\u8003\u8D44\u6599
1894
+ - \u5982\u679C\u662F\u6D4B\u8BD5\u4EFB\u52A1\uFF1A\u8865\u5145\u6D4B\u8BD5\u573A\u666F\u3001\u8986\u76D6\u8303\u56F4
1895
+ 4. **\u751F\u6210\u5B8C\u5584\u5185\u5BB9**\uFF1A\u4F7F\u7528 update_task \u66F4\u65B0\u4EFB\u52A1\u63CF\u8FF0
1896
+
1897
+ ## \u66F4\u65B0\u540E\u4EFB\u52A1\u5E94\u5305\u542B\uFF1A
1898
+
1899
+ \`\`\`
1900
+ ## \u80CC\u666F
1901
+ [\u4EFB\u52A1\u80CC\u666F\u548C\u76EE\u7684]
1902
+
1903
+ ## \u9A8C\u6536\u6807\u51C6
1904
+ - [ ] [\u6807\u51C61]
1905
+ - [ ] [\u6807\u51C62]
1906
+ - [ ] [\u6807\u51C63]
1907
+
1908
+ ## \u6280\u672F\u7EC6\u8282
1909
+ - \u6D89\u53CA\u6A21\u5757\uFF1A[\u6A21\u5757\u540D]
1910
+ - \u5173\u952E\u6587\u4EF6\uFF1A[\u6587\u4EF6\u8DEF\u5F84]
1911
+ - \u6CE8\u610F\u4E8B\u9879\uFF1A[\u91CD\u8981\u63D0\u9192]
1912
+
1913
+ ## \u76F8\u5173\u8D44\u6E90
1914
+ - \u6587\u6863\uFF1A[\u94FE\u63A5]
1915
+ - \u53C2\u8003\uFF1A[\u94FE\u63A5]
1916
+ \`\`\`
1917
+
1918
+ \u8BF7\u83B7\u53D6\u4EFB\u52A1\u4FE1\u606F\u540E\uFF0C\u7ED9\u51FA\u8BE6\u7EC6\u7684\u5B8C\u5584\u5EFA\u8BAE\u3002`
1919
+ }
1920
+ }
1921
+ ]
1922
+ };
1923
+ }
1924
+ function getQuickCapturePrompt(idea, projectId) {
1925
+ const projectContext = projectId ? `\u6DFB\u52A0\u5230\u9879\u76EE ${projectId}` : "\u81EA\u52A8\u9009\u62E9\u6700\u5408\u9002\u7684\u9879\u76EE";
1926
+ return {
1927
+ description: "\u5FEB\u901F\u6355\u6349\u52A9\u624B",
1928
+ messages: [
1929
+ {
1930
+ role: "user",
1931
+ content: {
1932
+ type: "text",
1933
+ text: `\u6211\u8981\u5FEB\u901F\u6355\u6349\u4E00\u4E2A\u60F3\u6CD5/\u4EFB\u52A1\uFF1A"${idea}"
1869
1934
 
1870
- ### Red (Requires Action)
1871
- - Critical tasks overdue
1872
- - Missed milestones
1873
- - No recent progress
1935
+ ${projectContext}
1874
1936
 
1875
- ## Navigation Guide
1937
+ ## \u8BF7\u5E2E\u6211\u5B8C\u6210\u4EE5\u4E0B\u6B65\u9AA4\uFF1A
1876
1938
 
1877
- ### Viewing Projects
1878
- - List all projects with key metrics
1879
- - Filter by status or type
1880
- - Sort by various criteria (updated, created, name)
1939
+ ### 1. \u4EFB\u52A1\u4FE1\u606F\u63D0\u53D6
1940
+ \u4ECE\u63CF\u8FF0\u4E2D\u63D0\u53D6\uFF1A
1941
+ - **\u4EFB\u52A1\u6807\u9898**\uFF1A\u7B80\u6D01\u660E\u786E\u7684\u6807\u9898\uFF08\u52A8\u8BCD\u5F00\u5934\uFF09
1942
+ - **\u4EFB\u52A1\u63CF\u8FF0**\uFF1A\u8865\u5145\u4E0A\u4E0B\u6587\u548C\u7EC6\u8282
1943
+ - **\u4EFB\u52A1\u7C7B\u578B**\uFF1Abug / feature / refactor / docs / chore
1944
+ - **\u9884\u4F30\u4F18\u5148\u7EA7**\uFF1Acritical / high / medium / low\uFF08\u57FA\u4E8E\u63CF\u8FF0\u5224\u65AD\u7D27\u6025\u7A0B\u5EA6\uFF09
1881
1945
 
1882
- ### Drilling Down
1883
- - View specific project details
1884
- - See all tasks for a project
1885
- - Check milestone progress
1886
- - Review tag usage
1946
+ ### 2. \u9879\u76EE\u63A8\u8350\uFF08\u5982\u679C\u672A\u6307\u5B9A\u9879\u76EE\uFF09
1947
+ \u5982\u679C\u7528\u6237\u6CA1\u6709\u6307\u5B9A\u9879\u76EE\uFF0C\u8BF7\uFF1A
1948
+ - \u5217\u51FA\u6240\u6709\u6D3B\u8DC3\u9879\u76EE
1949
+ - \u5206\u6790\u4EFB\u52A1\u5185\u5BB9\u4E0E\u54EA\u4E2A\u9879\u76EE\u6700\u76F8\u5173
1950
+ - \u63A8\u8350\u6700\u5408\u9002\u7684\u9879\u76EE
1887
1951
 
1888
- ### Taking Action
1889
- - Identify projects needing attention
1890
- - Find overdue tasks
1891
- - Review completed work
1892
- - Plan upcoming work
1952
+ ### 3. \u6807\u7B7E\u5EFA\u8BAE
1953
+ \u5EFA\u8BAE\u76F8\u5173\u7684\u6807\u7B7E\uFF1A
1954
+ - \u7C7B\u578B\u6807\u7B7E\uFF1Abug, feature, refactor, docs
1955
+ - \u4F18\u5148\u7EA7\u6807\u7B7E\uFF1Aurgent, important
1956
+ - \u9886\u57DF\u6807\u7B7E\uFF1Afrontend, backend, design, testing\uFF08\u5982\u9002\u7528\uFF09
1893
1957
 
1894
- ## Example Queries
1958
+ ### 4. \u751F\u6210\u4EFB\u52A1
1959
+ \u4F7F\u7528 create_task \u521B\u5EFA\u4EFB\u52A1
1895
1960
 
1896
- **"Show me all active projects"**
1897
- Lists projects with status = active, sorted by most recently updated
1961
+ ### 5. Status Recommendation
1962
+ After creating the task, if you start working on it immediately, consider setting the status to in-progress. Use update_task to keep progress updated during work, and mark as done when completed.
1898
1963
 
1899
- **"What tasks are overdue?"**
1900
- Shows all tasks where due date < today and status != done
1964
+ ## \u793A\u4F8B\uFF1A
1901
1965
 
1902
- **"Which projects are at risk?"**
1903
- Identifies projects with overdue critical/high priority tasks
1966
+ **\u8F93\u5165**\uFF1A"\u7528\u6237\u53CD\u9988\u767B\u5F55\u9875\u9762\u5728\u624B\u673A\u4E0A\u663E\u793A\u4E0D\u5BF9"
1904
1967
 
1905
- **"Show my progress this week"**
1906
- Displays tasks completed in the last 7 days
1968
+ **\u8F93\u51FA**\uFF1A
1969
+ - \u6807\u9898\uFF1A\u4FEE\u590D\u767B\u5F55\u9875\u9762\u79FB\u52A8\u7AEF\u9002\u914D\u95EE\u9898
1970
+ - \u63CF\u8FF0\uFF1A\u7528\u6237\u53CD\u9988\u767B\u5F55\u9875\u9762\u5728\u79FB\u52A8\u8BBE\u5907\u4E0A\u663E\u793A\u5F02\u5E38\uFF0C\u9700\u8981\u68C0\u67E5\u54CD\u5E94\u5F0F\u5E03\u5C40\u3002
1971
+ - \u7C7B\u578B\uFF1ABug
1972
+ - \u4F18\u5148\u7EA7\uFF1AHigh\uFF08\u5F71\u54CD\u7528\u6237\u4F53\u9A8C\uFF09
1973
+ - \u5EFA\u8BAE\u6807\u7B7E\uFF1Abug, frontend, mobile
1974
+ - \u63A8\u8350\u9879\u76EE\uFF1A[\u5982\u679C\u6709web\u9879\u76EE\u5219\u63A8\u8350]
1907
1975
 
1908
- ## Quick Actions
1976
+ ## \u5F53\u524D\u60F3\u6CD5\u5206\u6790\uFF1A
1909
1977
 
1910
- 1. **Review Overdue Items**: Check what needs immediate attention
1911
- 2. **Celebrate Wins**: Review recently completed tasks
1912
- 3. **Plan Ahead**: Look at upcoming milestones and deadlines
1913
- 4. **Clean Up**: Archive completed projects
1978
+ \u60F3\u6CD5\uFF1A"${idea}"
1914
1979
 
1915
- What would you like to see first? I can show you:
1916
- - A summary of all projects
1917
- - Overdue tasks across all projects
1918
- - Progress statistics
1919
- - Specific project details`
1920
- }
1921
- }
1922
- ]
1923
- };
1924
- }
1925
- function getMilestoneReviewPrompt(projectId) {
1926
- const projectContext = projectId ? `Reviewing milestones for project: ${projectId}` : "Reviewing milestones across all projects";
1927
- return {
1928
- description: "Milestone Review Assistant",
1929
- messages: [
1930
- {
1931
- role: "user",
1932
- content: {
1933
- type: "text",
1934
- text: `${projectContext}
1935
-
1936
- I'll help you review and evaluate your project milestones. Milestones are key checkpoints that help track significant progress.
1937
-
1938
- ## Milestone Review Framework
1939
-
1940
- ### What is a Milestone?
1941
- A milestone represents a significant achievement or checkpoint in your project:
1942
- - Major deliverable completion
1943
- - Phase transition
1944
- - Key decision point
1945
- - External deadline
1946
-
1947
- ### Milestone Status Types
1948
- - **Not Started**: Target date in future, no work completed
1949
- - **In Progress**: Work ongoing toward milestone
1950
- - **At Risk**: May not meet target date
1951
- - **Completed**: Achieved and marked complete
1952
- - **Missed**: Target date passed without completion
1953
-
1954
- ## Review Checklist
1955
-
1956
- ### For Each Milestone, Ask:
1957
-
1958
- 1. **Relevance**
1959
- - Is this milestone still relevant to project goals?
1960
- - Does it represent meaningful progress?
1961
- - Are the success criteria clear?
1962
-
1963
- 2. **Timeline**
1964
- - Is the target date realistic?
1965
- - Are there dependencies blocking progress?
1966
- - Do we need to adjust the date?
1967
-
1968
- 3. **Progress**
1969
- - What percentage complete is this milestone?
1970
- - Which tasks contribute to this milestone?
1971
- - Are there blockers or risks?
1972
-
1973
- 4. **Completion Criteria**
1974
- - What defines "complete" for this milestone?
1975
- - Are there acceptance criteria?
1976
- - Who needs to sign off?
1977
-
1978
- ## Milestone Management Actions
1979
-
1980
- ### Creating Milestones
1981
- Best practices for new milestones:
1982
- - Use clear, descriptive names
1983
- - Set realistic target dates
1984
- - Define completion criteria
1985
- - Link related tasks
1986
-
1987
- ### Updating Milestones
1988
- Common updates during review:
1989
- - Adjust target dates based on progress
1990
- - Update descriptions to reflect scope changes
1991
- - Mark completed when criteria met
1992
- - Archive obsolete milestones
1993
-
1994
- ### Tracking Progress
1995
- Ways to monitor milestone health:
1996
- - Percentage of linked tasks complete
1997
- - Time remaining vs. work remaining
1998
- - Risk assessment (low/medium/high)
1999
- - Dependency status
2000
-
2001
- ## Example Milestone Review
2002
-
2003
- **Project**: Website Redesign
2004
- **Milestone**: Design Phase Complete
2005
- **Target Date**: March 15, 2024
2006
-
2007
- **Review Questions**:
2008
- - \u2713 Relevance: Still critical path item
2009
- - \u26A0 Timeline: 5 days remaining, 60% complete
2010
- - Progress: 3 of 5 design tasks done
2011
- - Risks: User research taking longer than expected
2012
-
2013
- **Decision**: Extend target date by 3 days, add resources to user research
2014
-
2015
- ## Review Schedule Recommendations
2016
-
2017
- ### Weekly
2018
- - Quick check of upcoming milestones (next 2 weeks)
2019
- - Identify any at-risk items
2020
-
2021
- ### Monthly
2022
- - Full review of all active milestones
2023
- - Adjust timelines as needed
2024
- - Celebrate completed milestones
2025
-
2026
- ### Quarterly
2027
- - Strategic review of milestone alignment
2028
- - Archive completed project milestones
2029
- - Plan next quarter's milestones
2030
-
2031
- ## Metrics to Track
2032
-
2033
- - **Milestone Completion Rate**: % of milestones completed on time
2034
- - **Average Delay**: How often and by how much dates slip
2035
- - **Scope Changes**: Number of milestones added/removed
2036
- - **Predictability**: Variance between planned and actual dates
2037
-
2038
- What would you like to do?
2039
- - Review milestones for a specific project
2040
- - Identify at-risk milestones
2041
- - Plan new milestones
2042
- - Analyze milestone performance
2043
- - Update existing milestones`
1980
+ \u8BF7\u5206\u6790\u5E76\u751F\u6210\u4EFB\u52A1\u5EFA\u8BAE\u3002\u7528\u6237\u786E\u8BA4\u540E\uFF0C\u6267\u884C create_task \u521B\u5EFA\u4EFB\u52A1\u3002`
2044
1981
  }
2045
1982
  }
2046
1983
  ]
@@ -2048,14 +1985,14 @@ What would you like to do?
2048
1985
  }
2049
1986
  function getPromptByName(name, args) {
2050
1987
  switch (name) {
2051
- case "projectPlanningPrompt":
2052
- return getProjectPlanningPrompt(args?.projectType);
2053
- case "taskManagementPrompt":
2054
- return getTaskManagementPrompt(args?.projectId);
2055
- case "roadmapOverviewPrompt":
2056
- return getRoadmapOverviewPrompt();
2057
- case "milestoneReviewPrompt":
2058
- return getMilestoneReviewPrompt(args?.projectId);
1988
+ case "recommendNextTasks":
1989
+ return getRecommendNextTasksPrompt(args?.projectId, args?.limit);
1990
+ case "autoPrioritize":
1991
+ return getAutoPrioritizePrompt(args?.projectId);
1992
+ case "enhanceTaskDetails":
1993
+ return getEnhanceTaskDetailsPrompt(args?.taskId || "");
1994
+ case "quickCapture":
1995
+ return getQuickCapturePrompt(args?.idea || "", args?.projectId);
2059
1996
  default:
2060
1997
  return null;
2061
1998
  }
@@ -2090,7 +2027,7 @@ function createServer2() {
2090
2027
  const server = new Server(
2091
2028
  {
2092
2029
  name: "roadmap-skill",
2093
- version: "0.1.0"
2030
+ version: "0.2.0"
2094
2031
  },
2095
2032
  {
2096
2033
  capabilities: {
@@ -2100,65 +2037,97 @@ function createServer2() {
2100
2037
  }
2101
2038
  }
2102
2039
  );
2103
- server.setRequestHandler(ListToolsRequestSchema, async (_request) => {
2104
- return {
2105
- tools: allTools.map((tool) => {
2106
- const inputSchema = tool.parameters || tool.inputSchema;
2040
+ server.setRequestHandler(
2041
+ ListToolsRequestSchema,
2042
+ async (_request) => {
2043
+ return {
2044
+ tools: allTools.map((tool) => {
2045
+ const rawSchema = tool.parameters || tool.inputSchema;
2046
+ let inputSchema;
2047
+ if (!rawSchema) {
2048
+ inputSchema = { type: "object" };
2049
+ } else if (rawSchema.type === "object") {
2050
+ inputSchema = rawSchema;
2051
+ } else {
2052
+ inputSchema = zodToJsonSchema(rawSchema, {
2053
+ name: tool.name,
2054
+ $refStrategy: "none"
2055
+ }).definitions?.[tool.name] || { type: "object" };
2056
+ }
2057
+ return {
2058
+ name: tool.name,
2059
+ description: tool.description,
2060
+ inputSchema
2061
+ };
2062
+ })
2063
+ };
2064
+ }
2065
+ );
2066
+ server.setRequestHandler(
2067
+ CallToolRequestSchema,
2068
+ async (request) => {
2069
+ const { name, arguments: args } = request.params;
2070
+ const tool = toolMap.get(name);
2071
+ if (!tool) {
2072
+ throw new Error(`Unknown tool: ${name}`);
2073
+ }
2074
+ try {
2075
+ const result = await tool.execute(args);
2107
2076
  return {
2108
- name: tool.name,
2109
- description: tool.description,
2110
- inputSchema: inputSchema || { type: "object" }
2077
+ content: [
2078
+ {
2079
+ type: "text",
2080
+ text: JSON.stringify(result, null, 2)
2081
+ }
2082
+ ]
2111
2083
  };
2112
- })
2113
- };
2114
- });
2115
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
2116
- const { name, arguments: args } = request.params;
2117
- const tool = toolMap.get(name);
2118
- if (!tool) {
2119
- throw new Error(`Unknown tool: ${name}`);
2084
+ } catch (error) {
2085
+ const errorMessage = error instanceof Error ? error.message : String(error);
2086
+ throw new Error(`Tool execution failed: ${errorMessage}`);
2087
+ }
2120
2088
  }
2121
- try {
2122
- const result = await tool.execute(args);
2089
+ );
2090
+ server.setRequestHandler(
2091
+ ListResourcesRequestSchema,
2092
+ async (_request) => {
2093
+ const resources = getAllResources();
2094
+ return { resources };
2095
+ }
2096
+ );
2097
+ server.setRequestHandler(
2098
+ ReadResourceRequestSchema,
2099
+ async (request) => {
2100
+ const uri = request.params.uri;
2101
+ const resourceContent = await handleResourceRequest(uri);
2102
+ if (!resourceContent) {
2103
+ throw new Error(`Resource not found: ${uri}`);
2104
+ }
2123
2105
  return {
2124
- content: [
2125
- {
2126
- type: "text",
2127
- text: JSON.stringify(result, null, 2)
2128
- }
2129
- ]
2106
+ contents: [resourceContent]
2130
2107
  };
2131
- } catch (error) {
2132
- const errorMessage = error instanceof Error ? error.message : String(error);
2133
- throw new Error(`Tool execution failed: ${errorMessage}`);
2134
2108
  }
2135
- });
2136
- server.setRequestHandler(ListResourcesRequestSchema, async (_request) => {
2137
- const resources = getAllResources();
2138
- return { resources };
2139
- });
2140
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
2141
- const uri = request.params.uri;
2142
- const resourceContent = await handleResourceRequest(uri);
2143
- if (!resourceContent) {
2144
- throw new Error(`Resource not found: ${uri}`);
2109
+ );
2110
+ server.setRequestHandler(
2111
+ ListPromptsRequestSchema,
2112
+ async (_request) => {
2113
+ const prompts = getAllPrompts();
2114
+ return { prompts };
2145
2115
  }
2146
- return {
2147
- contents: [resourceContent]
2148
- };
2149
- });
2150
- server.setRequestHandler(ListPromptsRequestSchema, async (_request) => {
2151
- const prompts = getAllPrompts();
2152
- return { prompts };
2153
- });
2154
- server.setRequestHandler(GetPromptRequestSchema, async (request) => {
2155
- const { name, arguments: args } = request.params;
2156
- const promptResult = getPromptByName(name, args);
2157
- if (!promptResult) {
2158
- throw new Error(`Prompt not found: ${name}`);
2116
+ );
2117
+ server.setRequestHandler(
2118
+ GetPromptRequestSchema,
2119
+ async (request) => {
2120
+ const { name, arguments: args } = request.params;
2121
+ const promptResult = getPromptByName(
2122
+ name,
2123
+ args
2124
+ );
2125
+ if (!promptResult) {
2126
+ throw new Error(`Prompt not found: ${name}`);
2127
+ }
2128
+ return promptResult;
2159
2129
  }
2160
- return promptResult;
2161
- });
2130
+ );
2162
2131
  return server;
2163
2132
  }
2164
2133
  async function startServer() {