run-dmcp 0.1.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/LICENSE +22 -0
- package/README.md +79 -0
- package/dist/__tests__/engineVocabulary.test.d.ts +1 -0
- package/dist/__tests__/engineVocabulary.test.js +147 -0
- package/dist/db/__tests__/connection.test.d.ts +1 -0
- package/dist/db/__tests__/connection.test.js +72 -0
- package/dist/db/__tests__/testDb.d.ts +33 -0
- package/dist/db/__tests__/testDb.js +41 -0
- package/dist/db/connection.d.ts +22 -0
- package/dist/db/connection.js +107 -0
- package/dist/db/schema.d.ts +1 -0
- package/dist/db/schema.js +725 -0
- package/dist/events/emitter.d.ts +22 -0
- package/dist/events/emitter.js +71 -0
- package/dist/http/server.d.ts +3 -0
- package/dist/http/server.js +649 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +92 -0
- package/dist/register/abilities.d.ts +2 -0
- package/dist/register/abilities.js +165 -0
- package/dist/register/audio.d.ts +2 -0
- package/dist/register/audio.js +326 -0
- package/dist/register/batch.d.ts +2 -0
- package/dist/register/batch.js +343 -0
- package/dist/register/character.d.ts +2 -0
- package/dist/register/character.js +324 -0
- package/dist/register/combat.d.ts +2 -0
- package/dist/register/combat.js +207 -0
- package/dist/register/core.d.ts +2 -0
- package/dist/register/core.js +1040 -0
- package/dist/register/display.d.ts +2 -0
- package/dist/register/display.js +263 -0
- package/dist/register/factions.d.ts +2 -0
- package/dist/register/factions.js +186 -0
- package/dist/register/images.d.ts +2 -0
- package/dist/register/images.js +400 -0
- package/dist/register/inventory.d.ts +2 -0
- package/dist/register/inventory.js +115 -0
- package/dist/register/mcp-prompts.d.ts +2 -0
- package/dist/register/mcp-prompts.js +684 -0
- package/dist/register/mcp-resources.d.ts +2 -0
- package/dist/register/mcp-resources.js +335 -0
- package/dist/register/narrative.d.ts +2 -0
- package/dist/register/narrative.js +242 -0
- package/dist/register/notes.d.ts +2 -0
- package/dist/register/notes.js +170 -0
- package/dist/register/pause.d.ts +2 -0
- package/dist/register/pause.js +580 -0
- package/dist/register/quests.d.ts +2 -0
- package/dist/register/quests.js +118 -0
- package/dist/register/relationships.d.ts +2 -0
- package/dist/register/relationships.js +147 -0
- package/dist/register/resources.d.ts +2 -0
- package/dist/register/resources.js +277 -0
- package/dist/register/secrets.d.ts +2 -0
- package/dist/register/secrets.js +192 -0
- package/dist/register/status.d.ts +2 -0
- package/dist/register/status.js +130 -0
- package/dist/register/tables.d.ts +2 -0
- package/dist/register/tables.js +146 -0
- package/dist/register/tags.d.ts +2 -0
- package/dist/register/tags.js +114 -0
- package/dist/register/time.d.ts +2 -0
- package/dist/register/time.js +281 -0
- package/dist/register/world.d.ts +2 -0
- package/dist/register/world.js +127 -0
- package/dist/schemas/index.d.ts +921 -0
- package/dist/schemas/index.js +121 -0
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.js +13 -0
- package/dist/tools/__tests__/audio.test.d.ts +1 -0
- package/dist/tools/__tests__/audio.test.js +59 -0
- package/dist/tools/__tests__/conserved.test.d.ts +1 -0
- package/dist/tools/__tests__/conserved.test.js +488 -0
- package/dist/tools/__tests__/constraint.test.d.ts +1 -0
- package/dist/tools/__tests__/constraint.test.js +212 -0
- package/dist/tools/__tests__/expiry-consequences.test.d.ts +1 -0
- package/dist/tools/__tests__/expiry-consequences.test.js +110 -0
- package/dist/tools/__tests__/images.test.d.ts +1 -0
- package/dist/tools/__tests__/images.test.js +59 -0
- package/dist/tools/__tests__/relationship.test.d.ts +1 -0
- package/dist/tools/__tests__/relationship.test.js +132 -0
- package/dist/tools/__tests__/resource-constraints.test.d.ts +1 -0
- package/dist/tools/__tests__/resource-constraints.test.js +131 -0
- package/dist/tools/__tests__/resource.test.d.ts +1 -0
- package/dist/tools/__tests__/resource.test.js +190 -0
- package/dist/tools/__tests__/time.test.d.ts +1 -0
- package/dist/tools/__tests__/time.test.js +404 -0
- package/dist/tools/__tests__/timers.test.d.ts +1 -0
- package/dist/tools/__tests__/timers.test.js +426 -0
- package/dist/tools/__tests__/world.test.d.ts +1 -0
- package/dist/tools/__tests__/world.test.js +70 -0
- package/dist/tools/ability.d.ts +48 -0
- package/dist/tools/ability.js +238 -0
- package/dist/tools/audio.d.ts +24 -0
- package/dist/tools/audio.js +365 -0
- package/dist/tools/character.d.ts +70 -0
- package/dist/tools/character.js +309 -0
- package/dist/tools/combat.d.ts +13 -0
- package/dist/tools/combat.js +195 -0
- package/dist/tools/constraint.d.ts +132 -0
- package/dist/tools/constraint.js +269 -0
- package/dist/tools/dice.d.ts +23 -0
- package/dist/tools/dice.js +111 -0
- package/dist/tools/display.d.ts +120 -0
- package/dist/tools/display.js +528 -0
- package/dist/tools/faction.d.ts +61 -0
- package/dist/tools/faction.js +269 -0
- package/dist/tools/game.d.ts +96 -0
- package/dist/tools/game.js +526 -0
- package/dist/tools/image-prompt.d.ts +49 -0
- package/dist/tools/image-prompt.js +479 -0
- package/dist/tools/images.d.ts +47 -0
- package/dist/tools/images.js +449 -0
- package/dist/tools/inventory.d.ts +20 -0
- package/dist/tools/inventory.js +145 -0
- package/dist/tools/narrative.d.ts +58 -0
- package/dist/tools/narrative.js +237 -0
- package/dist/tools/notes.d.ts +41 -0
- package/dist/tools/notes.js +220 -0
- package/dist/tools/pause.d.ts +110 -0
- package/dist/tools/pause.js +1254 -0
- package/dist/tools/quest.d.ts +34 -0
- package/dist/tools/quest.js +164 -0
- package/dist/tools/relationship.d.ts +74 -0
- package/dist/tools/relationship.js +324 -0
- package/dist/tools/resource.d.ts +93 -0
- package/dist/tools/resource.js +374 -0
- package/dist/tools/rules.d.ts +4 -0
- package/dist/tools/rules.js +30 -0
- package/dist/tools/secrets.d.ts +49 -0
- package/dist/tools/secrets.js +195 -0
- package/dist/tools/status.d.ts +36 -0
- package/dist/tools/status.js +218 -0
- package/dist/tools/tables.d.ts +33 -0
- package/dist/tools/tables.js +209 -0
- package/dist/tools/tags.d.ts +52 -0
- package/dist/tools/tags.js +176 -0
- package/dist/tools/time.d.ts +33 -0
- package/dist/tools/time.js +276 -0
- package/dist/tools/timers.d.ts +41 -0
- package/dist/tools/timers.js +215 -0
- package/dist/tools/world.d.ts +78 -0
- package/dist/tools/world.js +331 -0
- package/dist/types/index.d.ts +969 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/__tests__/json.test.d.ts +1 -0
- package/dist/utils/__tests__/json.test.js +55 -0
- package/dist/utils/__tests__/validation.test.d.ts +1 -0
- package/dist/utils/__tests__/validation.test.js +90 -0
- package/dist/utils/errors.d.ts +44 -0
- package/dist/utils/errors.js +121 -0
- package/dist/utils/json.d.ts +9 -0
- package/dist/utils/json.js +23 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.js +50 -0
- package/dist/utils/output-schemas.d.ts +594 -0
- package/dist/utils/output-schemas.js +331 -0
- package/dist/utils/tool-annotations.d.ts +147 -0
- package/dist/utils/tool-annotations.js +98 -0
- package/dist/utils/validation.d.ts +34 -0
- package/dist/utils/validation.js +52 -0
- package/dist/utils/verbosity.d.ts +57 -0
- package/dist/utils/verbosity.js +67 -0
- package/dist/utils/webui.d.ts +20 -0
- package/dist/utils/webui.js +35 -0
- package/package.json +75 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as noteTools from "../tools/notes.js";
|
|
3
|
+
import { LIMITS } from "../utils/validation.js";
|
|
4
|
+
import { ANNOTATIONS } from "../utils/tool-annotations.js";
|
|
5
|
+
export function registerNoteTools(server) {
|
|
6
|
+
server.registerTool("create_note", {
|
|
7
|
+
description: "Create a game note",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
gameId: z.string().max(100).describe("The game ID"),
|
|
10
|
+
title: z.string().min(1).max(LIMITS.NAME_MAX).describe("Note title"),
|
|
11
|
+
content: z.string().max(LIMITS.CONTENT_MAX).describe("Note content (supports markdown)"),
|
|
12
|
+
category: z.string().max(100).optional().describe("Category (e.g., 'plot', 'npc', 'location', 'idea', 'recap')"),
|
|
13
|
+
relatedEntityId: z.string().max(100).optional().describe("ID of related entity"),
|
|
14
|
+
relatedEntityType: z.string().max(100).optional().describe("Type of related entity"),
|
|
15
|
+
tags: z.array(z.string().max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Tags for the note"),
|
|
16
|
+
pinned: z.boolean().optional().describe("Pin this note"),
|
|
17
|
+
},
|
|
18
|
+
annotations: ANNOTATIONS.CREATE,
|
|
19
|
+
}, async (params) => {
|
|
20
|
+
const note = noteTools.createNote(params);
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
server.registerTool("get_note", {
|
|
26
|
+
description: "Get a note by ID",
|
|
27
|
+
inputSchema: {
|
|
28
|
+
noteId: z.string().max(100).describe("The note ID"),
|
|
29
|
+
},
|
|
30
|
+
annotations: ANNOTATIONS.READ_ONLY,
|
|
31
|
+
}, async ({ noteId }) => {
|
|
32
|
+
const note = noteTools.getNote(noteId);
|
|
33
|
+
if (!note) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: "text", text: "Note not found" }],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
server.registerTool("update_note", {
|
|
44
|
+
description: "Update a note's content",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
noteId: z.string().max(100).describe("The note ID"),
|
|
47
|
+
title: z.string().max(LIMITS.NAME_MAX).optional().describe("New title"),
|
|
48
|
+
content: z.string().max(LIMITS.CONTENT_MAX).optional().describe("New content"),
|
|
49
|
+
category: z.string().max(100).nullable().optional().describe("New category"),
|
|
50
|
+
relatedEntityId: z.string().max(100).nullable().optional().describe("New related entity ID"),
|
|
51
|
+
relatedEntityType: z.string().max(100).nullable().optional().describe("New related entity type"),
|
|
52
|
+
tags: z.array(z.string().max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Replace tags"),
|
|
53
|
+
},
|
|
54
|
+
annotations: ANNOTATIONS.UPDATE,
|
|
55
|
+
}, async ({ noteId, ...updates }) => {
|
|
56
|
+
const note = noteTools.updateNote(noteId, updates);
|
|
57
|
+
if (!note) {
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: "Note not found" }],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
server.registerTool("delete_note", {
|
|
68
|
+
description: "Delete a note",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
noteId: z.string().max(100).describe("The note ID"),
|
|
71
|
+
},
|
|
72
|
+
annotations: ANNOTATIONS.DESTRUCTIVE,
|
|
73
|
+
}, async ({ noteId }) => {
|
|
74
|
+
const success = noteTools.deleteNote(noteId);
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: success ? "Note deleted" : "Note not found" }],
|
|
77
|
+
isError: !success,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
server.registerTool("list_notes", {
|
|
81
|
+
description: "List notes with optional filters",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
gameId: z.string().max(100).describe("The game ID"),
|
|
84
|
+
category: z.string().max(100).optional().describe("Filter by category"),
|
|
85
|
+
pinned: z.boolean().optional().describe("Filter by pinned status"),
|
|
86
|
+
tag: z.string().max(LIMITS.NAME_MAX).optional().describe("Filter by tag"),
|
|
87
|
+
relatedEntityId: z.string().max(100).optional().describe("Filter by related entity"),
|
|
88
|
+
},
|
|
89
|
+
annotations: ANNOTATIONS.READ_ONLY,
|
|
90
|
+
}, async ({ gameId, ...filter }) => {
|
|
91
|
+
const notes = noteTools.listNotes(gameId, filter);
|
|
92
|
+
return {
|
|
93
|
+
content: [{ type: "text", text: JSON.stringify(notes, null, 2) }],
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
server.registerTool("search_notes", {
|
|
97
|
+
description: "Search notes by title or content",
|
|
98
|
+
inputSchema: {
|
|
99
|
+
gameId: z.string().max(100).describe("The game ID"),
|
|
100
|
+
query: z.string().max(LIMITS.NAME_MAX).describe("Search query"),
|
|
101
|
+
},
|
|
102
|
+
annotations: ANNOTATIONS.READ_ONLY,
|
|
103
|
+
}, async ({ gameId, query }) => {
|
|
104
|
+
const notes = noteTools.searchNotes(gameId, query);
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: "text", text: JSON.stringify(notes, null, 2) }],
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
server.registerTool("pin_note", {
|
|
110
|
+
description: "Toggle a note's pinned status",
|
|
111
|
+
inputSchema: {
|
|
112
|
+
noteId: z.string().max(100).describe("The note ID"),
|
|
113
|
+
pinned: z.boolean().describe("Pin or unpin"),
|
|
114
|
+
},
|
|
115
|
+
annotations: ANNOTATIONS.UPDATE,
|
|
116
|
+
}, async ({ noteId, pinned }) => {
|
|
117
|
+
const note = noteTools.pinNote(noteId, pinned);
|
|
118
|
+
if (!note) {
|
|
119
|
+
return {
|
|
120
|
+
content: [{ type: "text", text: "Note not found" }],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// MODIFY NOTE TAGS - CONSOLIDATED (replaces add_note_tag + remove_note_tag)
|
|
130
|
+
// ============================================================================
|
|
131
|
+
server.registerTool("modify_note_tags", {
|
|
132
|
+
description: "Add and/or remove tags from a note in a single call. More efficient than separate add/remove calls.",
|
|
133
|
+
inputSchema: {
|
|
134
|
+
noteId: z.string().max(100).describe("The note ID"),
|
|
135
|
+
add: z.array(z.string().min(1).max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Tags to add"),
|
|
136
|
+
remove: z.array(z.string().max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Tags to remove"),
|
|
137
|
+
},
|
|
138
|
+
annotations: ANNOTATIONS.UPDATE,
|
|
139
|
+
}, async ({ noteId, add, remove }) => {
|
|
140
|
+
if (!add?.length && !remove?.length) {
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: "text", text: "No tags to add or remove" }],
|
|
143
|
+
isError: true,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const result = noteTools.modifyNoteTags(noteId, { add, remove });
|
|
147
|
+
if (!result) {
|
|
148
|
+
return {
|
|
149
|
+
content: [{ type: "text", text: "Note not found" }],
|
|
150
|
+
isError: true,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
server.registerTool("generate_recap", {
|
|
158
|
+
description: "Auto-generate a game recap note from recent narrative events",
|
|
159
|
+
inputSchema: {
|
|
160
|
+
gameId: z.string().max(100).describe("The game ID"),
|
|
161
|
+
eventLimit: z.number().optional().describe("Maximum events to include (default: 20)"),
|
|
162
|
+
},
|
|
163
|
+
annotations: ANNOTATIONS.CREATE,
|
|
164
|
+
}, async ({ gameId, eventLimit }) => {
|
|
165
|
+
const note = noteTools.generateRecap(gameId, eventLimit);
|
|
166
|
+
return {
|
|
167
|
+
content: [{ type: "text", text: JSON.stringify(note, null, 2) }],
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
}
|