paput-mcp 2.7.1 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/cli/export-skill.js +177 -0
- package/dist/cli/export-skill.js.map +1 -0
- package/dist/cli/index.js +14 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup-ai.js +48 -2
- package/dist/cli/setup-ai.js.map +1 -1
- package/dist/handlers/create-goal/handler.js +68 -0
- package/dist/handlers/create-goal/handler.js.map +1 -0
- package/dist/handlers/create-goal/index.js +3 -0
- package/dist/handlers/create-goal/index.js.map +1 -0
- package/dist/handlers/create-goal/tool.js +13 -0
- package/dist/handlers/create-goal/tool.js.map +1 -0
- package/dist/handlers/delete-goal/handler.js +37 -0
- package/dist/handlers/delete-goal/handler.js.map +1 -0
- package/dist/handlers/delete-goal/index.js +3 -0
- package/dist/handlers/delete-goal/index.js.map +1 -0
- package/dist/handlers/delete-goal/tool.js +13 -0
- package/dist/handlers/delete-goal/tool.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis/handler.js +51 -0
- package/dist/handlers/get-dashboard-analysis/handler.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis/index.js +3 -0
- package/dist/handlers/get-dashboard-analysis/index.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis/tool.js +13 -0
- package/dist/handlers/get-dashboard-analysis/tool.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis-context/handler.js +125 -0
- package/dist/handlers/get-dashboard-analysis-context/handler.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis-context/index.js +3 -0
- package/dist/handlers/get-dashboard-analysis-context/index.js.map +1 -0
- package/dist/handlers/get-dashboard-analysis-context/tool.js +13 -0
- package/dist/handlers/get-dashboard-analysis-context/tool.js.map +1 -0
- package/dist/handlers/index.js +7 -0
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/list-goals/handler.js +43 -0
- package/dist/handlers/list-goals/handler.js.map +1 -0
- package/dist/handlers/list-goals/index.js +3 -0
- package/dist/handlers/list-goals/index.js.map +1 -0
- package/dist/handlers/list-goals/tool.js +13 -0
- package/dist/handlers/list-goals/tool.js.map +1 -0
- package/dist/handlers/update-dashboard-analysis/handler.js +93 -0
- package/dist/handlers/update-dashboard-analysis/handler.js.map +1 -0
- package/dist/handlers/update-dashboard-analysis/index.js +3 -0
- package/dist/handlers/update-dashboard-analysis/index.js.map +1 -0
- package/dist/handlers/update-dashboard-analysis/tool.js +13 -0
- package/dist/handlers/update-dashboard-analysis/tool.js.map +1 -0
- package/dist/handlers/update-goal/handler.js +70 -0
- package/dist/handlers/update-goal/handler.js.map +1 -0
- package/dist/handlers/update-goal/index.js +3 -0
- package/dist/handlers/update-goal/index.js.map +1 -0
- package/dist/handlers/update-goal/tool.js +13 -0
- package/dist/handlers/update-goal/tool.js.map +1 -0
- package/dist/schemas/tool-input.js +76 -0
- package/dist/schemas/tool-input.js.map +1 -1
- package/dist/services/api/dashboard-analysis.js +7 -0
- package/dist/services/api/dashboard-analysis.js.map +1 -0
- package/dist/services/api/dashboard.js +4 -0
- package/dist/services/api/dashboard.js.map +1 -0
- package/dist/services/api/goal.js +13 -0
- package/dist/services/api/goal.js.map +1 -0
- package/dist/services/api/index.js +3 -0
- package/dist/services/api/index.js.map +1 -1
- package/dist/tool.js +8 -1
- package/dist/tool.js.map +1 -1
- package/dist/types/dashboard-analysis.js +2 -0
- package/dist/types/dashboard-analysis.js.map +1 -0
- package/dist/types/dashboard.js +2 -0
- package/dist/types/dashboard.js.map +1 -0
- package/dist/types/goal.js +2 -0
- package/dist/types/goal.js.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/docs/tools.md +31 -0
- package/docs/usage-examples.md +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handleGetDashboardAnalysis } from './handler.js';
|
|
2
|
+
export const getDashboardAnalysisTool = {
|
|
3
|
+
definition: {
|
|
4
|
+
name: 'paput_get_dashboard_analysis',
|
|
5
|
+
description: 'Get the saved PaPut dashboard analysis result.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: handleGetDashboardAnalysis,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/handlers/get-dashboard-analysis/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAgB;IACnD,UAAU,EAAE;QACV,IAAI,EAAE,8BAA8B;QACpC,WAAW,EAAE,gDAAgD;QAC7D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,0BAA0B;CACpC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { getCategories } from '../../services/api/category.js';
|
|
2
|
+
import { getDashboardSummary } from '../../services/api/dashboard.js';
|
|
3
|
+
import { getDashboardAnalysis } from '../../services/api/dashboard-analysis.js';
|
|
4
|
+
import { listGoals } from '../../services/api/goal.js';
|
|
5
|
+
import { searchMemos } from '../../services/api/memo.js';
|
|
6
|
+
import { searchNotes } from '../../services/api/note.js';
|
|
7
|
+
import { getSkillSheet } from '../../services/api/skill-sheet.js';
|
|
8
|
+
const RECENT_ITEM_LIMIT = 20;
|
|
9
|
+
export async function handleGetDashboardAnalysisContext(_args, apiClient) {
|
|
10
|
+
try {
|
|
11
|
+
const [dashboardSummary, goals] = await Promise.all([
|
|
12
|
+
getDashboardSummary(apiClient),
|
|
13
|
+
listGoals(apiClient),
|
|
14
|
+
]);
|
|
15
|
+
const [skillSheet, recentMemosResult, notesResult, categories, savedAnalysis,] = await Promise.all([
|
|
16
|
+
safeFetch(() => getSkillSheet(apiClient)),
|
|
17
|
+
safeFetch(() => searchMemos(apiClient, {
|
|
18
|
+
page: 1,
|
|
19
|
+
limit: RECENT_ITEM_LIMIT,
|
|
20
|
+
})),
|
|
21
|
+
safeFetch(() => searchNotes(apiClient, {
|
|
22
|
+
page: 1,
|
|
23
|
+
limit: RECENT_ITEM_LIMIT,
|
|
24
|
+
})),
|
|
25
|
+
safeFetch(() => getCategories(apiClient)),
|
|
26
|
+
safeFetch(() => getDashboardAnalysis(apiClient)),
|
|
27
|
+
]);
|
|
28
|
+
const recentMemos = recentMemosResult && recentMemosResult.success
|
|
29
|
+
? recentMemosResult.memos || []
|
|
30
|
+
: [];
|
|
31
|
+
const notes = notesResult && notesResult.success ? notesResult.notes || [] : [];
|
|
32
|
+
const prompt = buildPrompt({
|
|
33
|
+
dashboardSummary,
|
|
34
|
+
goals,
|
|
35
|
+
recentMemoCount: recentMemos.length,
|
|
36
|
+
noteCount: notes.length,
|
|
37
|
+
categoryCount: categories?.length || 0,
|
|
38
|
+
hasSkillSheet: Boolean(skillSheet),
|
|
39
|
+
hasSavedAnalysis: Boolean(savedAnalysis),
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
structuredContent: {
|
|
43
|
+
dashboard_summary: dashboardSummary,
|
|
44
|
+
goals,
|
|
45
|
+
skill_sheet: skillSheet,
|
|
46
|
+
recent_memos: recentMemos,
|
|
47
|
+
notes,
|
|
48
|
+
categories: categories || [],
|
|
49
|
+
saved_dashboard_analysis: savedAnalysis,
|
|
50
|
+
prompt,
|
|
51
|
+
},
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: `Dashboard analysis context:
|
|
56
|
+
Dashboard summary: total memos ${dashboardSummary.total_memo_count}, total notes ${dashboardSummary.total_note_count}, recent memos ${dashboardSummary.recent_memo_count}, active days in last 30 days ${dashboardSummary.active_days_in_last_30_days}
|
|
57
|
+
Goals: ${goals.length}
|
|
58
|
+
Skill sheet: ${skillSheet ? 'available' : 'not available'}
|
|
59
|
+
Recent memos: ${recentMemos.length}
|
|
60
|
+
Notes: ${notes.length}
|
|
61
|
+
Categories: ${categories?.length || 0}
|
|
62
|
+
Saved dashboard analysis: ${savedAnalysis ? 'available' : 'not available'}
|
|
63
|
+
|
|
64
|
+
${prompt}`,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{
|
|
74
|
+
type: 'text',
|
|
75
|
+
text: `Error while fetching dashboard analysis context: ${errorMessage}`,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
isError: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function safeFetch(fetcher) {
|
|
83
|
+
try {
|
|
84
|
+
return await fetcher();
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function buildPrompt(context) {
|
|
91
|
+
const activeGoals = context.goals.filter((goal) => goal.status === 'active');
|
|
92
|
+
const archivedGoals = context.goals.filter((goal) => goal.status === 'archived');
|
|
93
|
+
return `Create a dashboard analysis as the MCP client AI, using the PaPut data in structuredContent. paput-mcp does not contain analysis logic, so you should read the source data and adapt the analysis to the user's goals and context. Write the final output in the user's language and match the user's tone when possible.
|
|
94
|
+
|
|
95
|
+
Assumptions:
|
|
96
|
+
- Do not recalculate dashboard continuity from activities. Use the summary values returned by the API.
|
|
97
|
+
- Treat active goals as the current basis for analysis and archived goals as historical context.
|
|
98
|
+
- Do not assume that the user should write memos next. Analyze how knowledge that naturally accumulates through daily development can grow toward the goals.
|
|
99
|
+
- If existing skill sheet or project AI summaries are available, use them as references for career-history phrasing.
|
|
100
|
+
|
|
101
|
+
Context summary:
|
|
102
|
+
- Total memo count: ${context.dashboardSummary.total_memo_count}
|
|
103
|
+
- Total note count: ${context.dashboardSummary.total_note_count}
|
|
104
|
+
- Recent memo count: ${context.dashboardSummary.recent_memo_count}
|
|
105
|
+
- Active days in the last 30 days: ${context.dashboardSummary.active_days_in_last_30_days}
|
|
106
|
+
- Active goals: ${activeGoals.length}
|
|
107
|
+
- Archived goals: ${archivedGoals.length}
|
|
108
|
+
- Retrieved recent memos: ${context.recentMemoCount}
|
|
109
|
+
- Retrieved notes: ${context.noteCount}
|
|
110
|
+
- Retrieved categories: ${context.categoryCount}
|
|
111
|
+
- Skill sheet: ${context.hasSkillSheet ? 'available' : 'not available'}
|
|
112
|
+
- Saved analysis: ${context.hasSavedAnalysis ? 'available' : 'not available'}
|
|
113
|
+
|
|
114
|
+
Include these analysis points:
|
|
115
|
+
1. The user's current position
|
|
116
|
+
2. Areas that can be presented as strengths
|
|
117
|
+
3. Areas that have been growing recently
|
|
118
|
+
4. Thin or underdeveloped areas
|
|
119
|
+
5. Knowledge missing against the user's goals
|
|
120
|
+
6. Knowledge the user should learn next
|
|
121
|
+
7. Phrasing that can be used in a skill sheet or career history
|
|
122
|
+
|
|
123
|
+
If saving the result, build values suitable for paput_update_dashboard_analysis: current_summary, strengths, growing_areas, weak_areas, next_knowledge_suggestions, and analyzed_at. strengths, growing_areas, and weak_areas should include title, description, category_names, memo_count, and goal_ids. next_knowledge_suggestions should include title, reason, priority, category_names, and goal_ids.`;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/handlers/get-dashboard-analysis-context/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,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":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handleGetDashboardAnalysisContext } from './handler.js';
|
|
2
|
+
export const getDashboardAnalysisContextTool = {
|
|
3
|
+
definition: {
|
|
4
|
+
name: 'paput_get_dashboard_analysis_context',
|
|
5
|
+
description: 'Get dashboard, goals, skill sheet, recent memo, note, and category context so the MCP client AI model can generate a dashboard analysis.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: handleGetDashboardAnalysisContext,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/handlers/get-dashboard-analysis-context/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,CAAC,MAAM,+BAA+B,GAAgB;IAC1D,UAAU,EAAE;QACV,IAAI,EAAE,sCAAsC;QAC5C,WAAW,EACT,0IAA0I;QAC5I,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,iCAAiC;CAC3C,CAAC"}
|
package/dist/handlers/index.js
CHANGED
|
@@ -15,6 +15,13 @@ export * from './upsert-skill-sheet-project/index.js';
|
|
|
15
15
|
export * from './delete-skill-sheet-project/index.js';
|
|
16
16
|
export * from './get-skill-sheet-project-summary-context/index.js';
|
|
17
17
|
export * from './update-skill-sheet-project-ai-summary/index.js';
|
|
18
|
+
export * from './list-goals/index.js';
|
|
19
|
+
export * from './create-goal/index.js';
|
|
20
|
+
export * from './update-goal/index.js';
|
|
21
|
+
export * from './delete-goal/index.js';
|
|
22
|
+
export * from './get-dashboard-analysis/index.js';
|
|
23
|
+
export * from './update-dashboard-analysis/index.js';
|
|
24
|
+
export * from './get-dashboard-analysis-context/index.js';
|
|
18
25
|
export * from './cache-status/index.js';
|
|
19
26
|
export * from './sync-remote-memos/index.js';
|
|
20
27
|
export * from './scan-sessions/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AACjE,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AACjE,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { listGoals } from '../../services/api/goal.js';
|
|
2
|
+
export async function handleListGoals(_args, apiClient) {
|
|
3
|
+
try {
|
|
4
|
+
const goals = await listGoals(apiClient);
|
|
5
|
+
if (goals.length === 0) {
|
|
6
|
+
return {
|
|
7
|
+
structuredContent: { goals: [] },
|
|
8
|
+
content: [{ type: 'text', text: 'Goals were not found.' }],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const goalList = goals
|
|
12
|
+
.map((goal) => {
|
|
13
|
+
const targetDate = goal.target_date || 'Not set';
|
|
14
|
+
const description = goal.description || 'Not set';
|
|
15
|
+
return `- [${goal.id}] ${goal.title} (${goal.status}, ${goal.category}, priority ${goal.priority})
|
|
16
|
+
Target date: ${targetDate}
|
|
17
|
+
Description: ${description}`;
|
|
18
|
+
})
|
|
19
|
+
.join('\n');
|
|
20
|
+
return {
|
|
21
|
+
structuredContent: { goals },
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: `Goals:\n${goalList}`,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: `Error while fetching goals: ${errorMessage}`,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
isError: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/handlers/list-goals/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAA0C,EAC1C,SAAoB;IAEpB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC;QAEzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO;gBACL,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;gBAChC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;aAC3D,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,KAAK;aACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC;YACjD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC;YAClD,OAAO,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,cAAc,IAAI,CAAC,QAAQ;iBACvF,UAAU;iBACV,WAAW,EAAE,CAAC;QACzB,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO;YACL,iBAAiB,EAAE,EAAE,KAAK,EAAE;YAC5B,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,QAAQ,EAAE;iBAC5B;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAE3D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,+BAA+B,YAAY,EAAE;iBACpD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/list-goals/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handleListGoals } from './handler.js';
|
|
2
|
+
export const listGoalsTool = {
|
|
3
|
+
definition: {
|
|
4
|
+
name: 'paput_list_goals',
|
|
5
|
+
description: 'List PaPut goals. Active goals are usually used as the basis for analysis, and archived goals are treated as history.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: handleListGoals,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/handlers/list-goals/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,UAAU,EAAE;QACV,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACT,uHAAuH;QACzH,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,eAAe;CACzB,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { updateDashboardAnalysis } from '../../services/api/dashboard-analysis.js';
|
|
2
|
+
export async function handleUpdateDashboardAnalysis(args, apiClient) {
|
|
3
|
+
const params = parseParams(args);
|
|
4
|
+
if (!params) {
|
|
5
|
+
return {
|
|
6
|
+
content: [
|
|
7
|
+
{
|
|
8
|
+
type: 'text',
|
|
9
|
+
text: 'Current summary and analyzed_at are required.',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
isError: true,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const analysis = await updateDashboardAnalysis(apiClient, params);
|
|
17
|
+
return {
|
|
18
|
+
structuredContent: {
|
|
19
|
+
success: true,
|
|
20
|
+
dashboard_analysis: analysis,
|
|
21
|
+
},
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: `Dashboard analysis was updated. ID: ${analysis.id}`,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: `Error while updating dashboard analysis: ${errorMessage}`,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
isError: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function parseParams(args) {
|
|
44
|
+
if (!args ||
|
|
45
|
+
typeof args.current_summary !== 'string' ||
|
|
46
|
+
typeof args.analyzed_at !== 'string') {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
current_summary: args.current_summary,
|
|
51
|
+
strengths: parseItems(args.strengths),
|
|
52
|
+
growing_areas: parseItems(args.growing_areas),
|
|
53
|
+
weak_areas: parseItems(args.weak_areas),
|
|
54
|
+
next_knowledge_suggestions: parseSuggestions(args.next_knowledge_suggestions),
|
|
55
|
+
analyzed_at: args.analyzed_at,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function parseItems(value) {
|
|
59
|
+
if (!Array.isArray(value))
|
|
60
|
+
return [];
|
|
61
|
+
return value.filter(isRecord).map((item) => ({
|
|
62
|
+
title: typeof item.title === 'string' ? item.title : '',
|
|
63
|
+
description: typeof item.description === 'string' ? item.description : '',
|
|
64
|
+
category_names: parseStringArray(item.category_names),
|
|
65
|
+
memo_count: typeof item.memo_count === 'number' ? item.memo_count : null,
|
|
66
|
+
goal_ids: parseNumberArray(item.goal_ids),
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
function parseSuggestions(value) {
|
|
70
|
+
if (!Array.isArray(value))
|
|
71
|
+
return [];
|
|
72
|
+
return value.filter(isRecord).map((suggestion) => ({
|
|
73
|
+
title: typeof suggestion.title === 'string' ? suggestion.title : '',
|
|
74
|
+
reason: typeof suggestion.reason === 'string' ? suggestion.reason : '',
|
|
75
|
+
priority: typeof suggestion.priority === 'number' ? suggestion.priority : 1,
|
|
76
|
+
category_names: parseStringArray(suggestion.category_names),
|
|
77
|
+
goal_ids: parseNumberArray(suggestion.goal_ids),
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
function parseStringArray(value) {
|
|
81
|
+
return Array.isArray(value)
|
|
82
|
+
? value.filter((item) => typeof item === 'string')
|
|
83
|
+
: [];
|
|
84
|
+
}
|
|
85
|
+
function parseNumberArray(value) {
|
|
86
|
+
return Array.isArray(value)
|
|
87
|
+
? value.filter((item) => typeof item === 'number')
|
|
88
|
+
: [];
|
|
89
|
+
}
|
|
90
|
+
function isRecord(value) {
|
|
91
|
+
return typeof value === 'object' && value !== null;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/handlers/update-dashboard-analysis/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAOnF,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAAyC,EACzC,SAAoB;IAEpB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,+CAA+C;iBACtD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAElE,OAAO;YACL,iBAAiB,EAAE;gBACjB,OAAO,EAAE,IAAI;gBACb,kBAAkB,EAAE,QAAQ;aAC7B;YACD,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uCAAuC,QAAQ,CAAC,EAAE,EAAE;iBAC3D;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAE3D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,4CAA4C,YAAY,EAAE;iBACjE;aACF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AQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/update-dashboard-analysis/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handleUpdateDashboardAnalysis } from './handler.js';
|
|
2
|
+
export const updateDashboardAnalysisTool = {
|
|
3
|
+
definition: {
|
|
4
|
+
name: 'paput_update_dashboard_analysis',
|
|
5
|
+
description: 'Save a dashboard analysis result generated by the MCP client AI model.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: handleUpdateDashboardAnalysis,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/handlers/update-dashboard-analysis/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,CAAC,MAAM,2BAA2B,GAAgB;IACtD,UAAU,EAAE;QACV,IAAI,EAAE,iCAAiC;QACvC,WAAW,EACT,wEAAwE;QAC1E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,6BAA6B;CACvC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { updateGoal } from '../../services/api/goal.js';
|
|
2
|
+
const goalCategories = ['career', 'learning', 'portfolio', 'project', 'other'];
|
|
3
|
+
const goalStatuses = ['active', 'archived'];
|
|
4
|
+
export async function handleUpdateGoal(args, apiClient) {
|
|
5
|
+
const params = parseUpdateGoalParams(args);
|
|
6
|
+
if (!params) {
|
|
7
|
+
return {
|
|
8
|
+
content: [
|
|
9
|
+
{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: 'ID, title, category, status, and priority are required.',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
isError: true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
await updateGoal(apiClient, params);
|
|
19
|
+
return {
|
|
20
|
+
structuredContent: {
|
|
21
|
+
success: true,
|
|
22
|
+
goal: params,
|
|
23
|
+
},
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: `Goal was updated: ${params.title} (ID: ${params.id})`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: `Error while updating goal: ${errorMessage}`,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
isError: true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function parseUpdateGoalParams(args) {
|
|
46
|
+
if (!args ||
|
|
47
|
+
typeof args.id !== 'number' ||
|
|
48
|
+
typeof args.title !== 'string' ||
|
|
49
|
+
!isGoalCategory(args.category) ||
|
|
50
|
+
!isGoalStatus(args.status) ||
|
|
51
|
+
typeof args.priority !== 'number') {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
id: args.id,
|
|
56
|
+
title: args.title,
|
|
57
|
+
description: typeof args.description === 'string' ? args.description : null,
|
|
58
|
+
category: args.category,
|
|
59
|
+
status: args.status,
|
|
60
|
+
priority: args.priority,
|
|
61
|
+
target_date: typeof args.target_date === 'string' ? args.target_date : null,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function isGoalCategory(value) {
|
|
65
|
+
return typeof value === 'string' && goalCategories.includes(value);
|
|
66
|
+
}
|
|
67
|
+
function isGoalStatus(value) {
|
|
68
|
+
return typeof value === 'string' && goalStatuses.includes(value);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/handlers/update-goal/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAOxD,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/E,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAyC,EACzC,SAAoB;IAEpB,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,yDAAyD;iBAChE;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEpC,OAAO;YACL,iBAAiB,EAAE;gBACjB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM;aACb;YACD,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qBAAqB,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,EAAE,GAAG;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CA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AAQ,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/update-goal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { handleUpdateGoal } from './handler.js';
|
|
2
|
+
export const updateGoalTool = {
|
|
3
|
+
definition: {
|
|
4
|
+
name: 'paput_update_goal',
|
|
5
|
+
description: 'Update a PaPut goal. The update request body must include the goal ID.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: handleUpdateGoal,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/handlers/update-goal/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,UAAU,EAAE;QACV,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,wEAAwE;QAC1E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,gBAAgB;CAC1B,CAAC"}
|
|
@@ -60,6 +60,52 @@ const knowledgeCandidateSchema = z.object({
|
|
|
60
60
|
confidence: z.number().optional(),
|
|
61
61
|
is_public: z.boolean().default(false).optional(),
|
|
62
62
|
});
|
|
63
|
+
const goalCategorySchema = z
|
|
64
|
+
.enum(['career', 'learning', 'portfolio', 'project', 'other'])
|
|
65
|
+
.describe('Goal category');
|
|
66
|
+
const goalStatusSchema = z
|
|
67
|
+
.enum(['active', 'archived'])
|
|
68
|
+
.describe('Goal status. Active goals are current targets; archived goals are history.');
|
|
69
|
+
const goalInputSchema = z.object({
|
|
70
|
+
title: z.string().describe('Goal title'),
|
|
71
|
+
description: z.string().describe('Goal description').nullable().optional(),
|
|
72
|
+
category: goalCategorySchema,
|
|
73
|
+
status: goalStatusSchema,
|
|
74
|
+
priority: z
|
|
75
|
+
.number()
|
|
76
|
+
.min(1)
|
|
77
|
+
.describe('Goal priority. Lower numbers are higher priority.'),
|
|
78
|
+
target_date: z
|
|
79
|
+
.string()
|
|
80
|
+
.describe('Target date in YYYY-MM-DD format')
|
|
81
|
+
.nullable()
|
|
82
|
+
.optional(),
|
|
83
|
+
});
|
|
84
|
+
const dashboardAnalysisItemSchema = z.object({
|
|
85
|
+
title: z.string().describe('Item title'),
|
|
86
|
+
description: z.string().describe('Item description'),
|
|
87
|
+
category_names: z
|
|
88
|
+
.array(z.string())
|
|
89
|
+
.describe('Related category names')
|
|
90
|
+
.optional(),
|
|
91
|
+
memo_count: z
|
|
92
|
+
.number()
|
|
93
|
+
.min(0)
|
|
94
|
+
.describe('Related memo count')
|
|
95
|
+
.nullable()
|
|
96
|
+
.optional(),
|
|
97
|
+
goal_ids: z.array(z.number()).describe('Related goal IDs').optional(),
|
|
98
|
+
});
|
|
99
|
+
const dashboardAnalysisSuggestionSchema = z.object({
|
|
100
|
+
title: z.string().describe('Suggestion title'),
|
|
101
|
+
reason: z.string().describe('Suggestion reason'),
|
|
102
|
+
priority: z.number().min(1).describe('Suggestion priority'),
|
|
103
|
+
category_names: z
|
|
104
|
+
.array(z.string())
|
|
105
|
+
.describe('Related category names')
|
|
106
|
+
.optional(),
|
|
107
|
+
goal_ids: z.array(z.number()).describe('Related goal IDs').optional(),
|
|
108
|
+
});
|
|
63
109
|
const toolInputSchemas = {
|
|
64
110
|
paput_create_memo: z.object({
|
|
65
111
|
title: z.string().describe('Memo title'),
|
|
@@ -175,6 +221,36 @@ const toolInputSchemas = {
|
|
|
175
221
|
project_id: z.number().describe('Project ID'),
|
|
176
222
|
ai_summary: z.string().describe('AI-generated project summary to save'),
|
|
177
223
|
}),
|
|
224
|
+
paput_list_goals: emptySchema,
|
|
225
|
+
paput_create_goal: goalInputSchema,
|
|
226
|
+
paput_update_goal: goalInputSchema.extend({
|
|
227
|
+
id: z.number().describe('Goal ID. Required in the update request body.'),
|
|
228
|
+
}),
|
|
229
|
+
paput_delete_goal: z.object({
|
|
230
|
+
id: z.number().describe('Goal ID'),
|
|
231
|
+
}),
|
|
232
|
+
paput_get_dashboard_analysis: emptySchema,
|
|
233
|
+
paput_update_dashboard_analysis: z.object({
|
|
234
|
+
current_summary: z.string().describe('Current summary'),
|
|
235
|
+
strengths: z
|
|
236
|
+
.array(dashboardAnalysisItemSchema)
|
|
237
|
+
.describe('Strengths')
|
|
238
|
+
.optional(),
|
|
239
|
+
growing_areas: z
|
|
240
|
+
.array(dashboardAnalysisItemSchema)
|
|
241
|
+
.describe('Recently growing areas')
|
|
242
|
+
.optional(),
|
|
243
|
+
weak_areas: z
|
|
244
|
+
.array(dashboardAnalysisItemSchema)
|
|
245
|
+
.describe('Thin or weak areas')
|
|
246
|
+
.optional(),
|
|
247
|
+
next_knowledge_suggestions: z
|
|
248
|
+
.array(dashboardAnalysisSuggestionSchema)
|
|
249
|
+
.describe('Knowledge suggestions to learn next')
|
|
250
|
+
.optional(),
|
|
251
|
+
analyzed_at: z.string().describe('Analysis timestamp in ISO 8601 format'),
|
|
252
|
+
}),
|
|
253
|
+
paput_get_dashboard_analysis_context: emptySchema,
|
|
178
254
|
paput_cache_status: emptySchema,
|
|
179
255
|
paput_sync_remote_memos: z.object({
|
|
180
256
|
limit: z
|