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.
Files changed (167) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +79 -0
  3. package/dist/__tests__/engineVocabulary.test.d.ts +1 -0
  4. package/dist/__tests__/engineVocabulary.test.js +147 -0
  5. package/dist/db/__tests__/connection.test.d.ts +1 -0
  6. package/dist/db/__tests__/connection.test.js +72 -0
  7. package/dist/db/__tests__/testDb.d.ts +33 -0
  8. package/dist/db/__tests__/testDb.js +41 -0
  9. package/dist/db/connection.d.ts +22 -0
  10. package/dist/db/connection.js +107 -0
  11. package/dist/db/schema.d.ts +1 -0
  12. package/dist/db/schema.js +725 -0
  13. package/dist/events/emitter.d.ts +22 -0
  14. package/dist/events/emitter.js +71 -0
  15. package/dist/http/server.d.ts +3 -0
  16. package/dist/http/server.js +649 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +92 -0
  19. package/dist/register/abilities.d.ts +2 -0
  20. package/dist/register/abilities.js +165 -0
  21. package/dist/register/audio.d.ts +2 -0
  22. package/dist/register/audio.js +326 -0
  23. package/dist/register/batch.d.ts +2 -0
  24. package/dist/register/batch.js +343 -0
  25. package/dist/register/character.d.ts +2 -0
  26. package/dist/register/character.js +324 -0
  27. package/dist/register/combat.d.ts +2 -0
  28. package/dist/register/combat.js +207 -0
  29. package/dist/register/core.d.ts +2 -0
  30. package/dist/register/core.js +1040 -0
  31. package/dist/register/display.d.ts +2 -0
  32. package/dist/register/display.js +263 -0
  33. package/dist/register/factions.d.ts +2 -0
  34. package/dist/register/factions.js +186 -0
  35. package/dist/register/images.d.ts +2 -0
  36. package/dist/register/images.js +400 -0
  37. package/dist/register/inventory.d.ts +2 -0
  38. package/dist/register/inventory.js +115 -0
  39. package/dist/register/mcp-prompts.d.ts +2 -0
  40. package/dist/register/mcp-prompts.js +684 -0
  41. package/dist/register/mcp-resources.d.ts +2 -0
  42. package/dist/register/mcp-resources.js +335 -0
  43. package/dist/register/narrative.d.ts +2 -0
  44. package/dist/register/narrative.js +242 -0
  45. package/dist/register/notes.d.ts +2 -0
  46. package/dist/register/notes.js +170 -0
  47. package/dist/register/pause.d.ts +2 -0
  48. package/dist/register/pause.js +580 -0
  49. package/dist/register/quests.d.ts +2 -0
  50. package/dist/register/quests.js +118 -0
  51. package/dist/register/relationships.d.ts +2 -0
  52. package/dist/register/relationships.js +147 -0
  53. package/dist/register/resources.d.ts +2 -0
  54. package/dist/register/resources.js +277 -0
  55. package/dist/register/secrets.d.ts +2 -0
  56. package/dist/register/secrets.js +192 -0
  57. package/dist/register/status.d.ts +2 -0
  58. package/dist/register/status.js +130 -0
  59. package/dist/register/tables.d.ts +2 -0
  60. package/dist/register/tables.js +146 -0
  61. package/dist/register/tags.d.ts +2 -0
  62. package/dist/register/tags.js +114 -0
  63. package/dist/register/time.d.ts +2 -0
  64. package/dist/register/time.js +281 -0
  65. package/dist/register/world.d.ts +2 -0
  66. package/dist/register/world.js +127 -0
  67. package/dist/schemas/index.d.ts +921 -0
  68. package/dist/schemas/index.js +121 -0
  69. package/dist/test-setup.d.ts +1 -0
  70. package/dist/test-setup.js +13 -0
  71. package/dist/tools/__tests__/audio.test.d.ts +1 -0
  72. package/dist/tools/__tests__/audio.test.js +59 -0
  73. package/dist/tools/__tests__/conserved.test.d.ts +1 -0
  74. package/dist/tools/__tests__/conserved.test.js +488 -0
  75. package/dist/tools/__tests__/constraint.test.d.ts +1 -0
  76. package/dist/tools/__tests__/constraint.test.js +212 -0
  77. package/dist/tools/__tests__/expiry-consequences.test.d.ts +1 -0
  78. package/dist/tools/__tests__/expiry-consequences.test.js +110 -0
  79. package/dist/tools/__tests__/images.test.d.ts +1 -0
  80. package/dist/tools/__tests__/images.test.js +59 -0
  81. package/dist/tools/__tests__/relationship.test.d.ts +1 -0
  82. package/dist/tools/__tests__/relationship.test.js +132 -0
  83. package/dist/tools/__tests__/resource-constraints.test.d.ts +1 -0
  84. package/dist/tools/__tests__/resource-constraints.test.js +131 -0
  85. package/dist/tools/__tests__/resource.test.d.ts +1 -0
  86. package/dist/tools/__tests__/resource.test.js +190 -0
  87. package/dist/tools/__tests__/time.test.d.ts +1 -0
  88. package/dist/tools/__tests__/time.test.js +404 -0
  89. package/dist/tools/__tests__/timers.test.d.ts +1 -0
  90. package/dist/tools/__tests__/timers.test.js +426 -0
  91. package/dist/tools/__tests__/world.test.d.ts +1 -0
  92. package/dist/tools/__tests__/world.test.js +70 -0
  93. package/dist/tools/ability.d.ts +48 -0
  94. package/dist/tools/ability.js +238 -0
  95. package/dist/tools/audio.d.ts +24 -0
  96. package/dist/tools/audio.js +365 -0
  97. package/dist/tools/character.d.ts +70 -0
  98. package/dist/tools/character.js +309 -0
  99. package/dist/tools/combat.d.ts +13 -0
  100. package/dist/tools/combat.js +195 -0
  101. package/dist/tools/constraint.d.ts +132 -0
  102. package/dist/tools/constraint.js +269 -0
  103. package/dist/tools/dice.d.ts +23 -0
  104. package/dist/tools/dice.js +111 -0
  105. package/dist/tools/display.d.ts +120 -0
  106. package/dist/tools/display.js +528 -0
  107. package/dist/tools/faction.d.ts +61 -0
  108. package/dist/tools/faction.js +269 -0
  109. package/dist/tools/game.d.ts +96 -0
  110. package/dist/tools/game.js +526 -0
  111. package/dist/tools/image-prompt.d.ts +49 -0
  112. package/dist/tools/image-prompt.js +479 -0
  113. package/dist/tools/images.d.ts +47 -0
  114. package/dist/tools/images.js +449 -0
  115. package/dist/tools/inventory.d.ts +20 -0
  116. package/dist/tools/inventory.js +145 -0
  117. package/dist/tools/narrative.d.ts +58 -0
  118. package/dist/tools/narrative.js +237 -0
  119. package/dist/tools/notes.d.ts +41 -0
  120. package/dist/tools/notes.js +220 -0
  121. package/dist/tools/pause.d.ts +110 -0
  122. package/dist/tools/pause.js +1254 -0
  123. package/dist/tools/quest.d.ts +34 -0
  124. package/dist/tools/quest.js +164 -0
  125. package/dist/tools/relationship.d.ts +74 -0
  126. package/dist/tools/relationship.js +324 -0
  127. package/dist/tools/resource.d.ts +93 -0
  128. package/dist/tools/resource.js +374 -0
  129. package/dist/tools/rules.d.ts +4 -0
  130. package/dist/tools/rules.js +30 -0
  131. package/dist/tools/secrets.d.ts +49 -0
  132. package/dist/tools/secrets.js +195 -0
  133. package/dist/tools/status.d.ts +36 -0
  134. package/dist/tools/status.js +218 -0
  135. package/dist/tools/tables.d.ts +33 -0
  136. package/dist/tools/tables.js +209 -0
  137. package/dist/tools/tags.d.ts +52 -0
  138. package/dist/tools/tags.js +176 -0
  139. package/dist/tools/time.d.ts +33 -0
  140. package/dist/tools/time.js +276 -0
  141. package/dist/tools/timers.d.ts +41 -0
  142. package/dist/tools/timers.js +215 -0
  143. package/dist/tools/world.d.ts +78 -0
  144. package/dist/tools/world.js +331 -0
  145. package/dist/types/index.d.ts +969 -0
  146. package/dist/types/index.js +1 -0
  147. package/dist/utils/__tests__/json.test.d.ts +1 -0
  148. package/dist/utils/__tests__/json.test.js +55 -0
  149. package/dist/utils/__tests__/validation.test.d.ts +1 -0
  150. package/dist/utils/__tests__/validation.test.js +90 -0
  151. package/dist/utils/errors.d.ts +44 -0
  152. package/dist/utils/errors.js +121 -0
  153. package/dist/utils/json.d.ts +9 -0
  154. package/dist/utils/json.js +23 -0
  155. package/dist/utils/logger.d.ts +7 -0
  156. package/dist/utils/logger.js +50 -0
  157. package/dist/utils/output-schemas.d.ts +594 -0
  158. package/dist/utils/output-schemas.js +331 -0
  159. package/dist/utils/tool-annotations.d.ts +147 -0
  160. package/dist/utils/tool-annotations.js +98 -0
  161. package/dist/utils/validation.d.ts +34 -0
  162. package/dist/utils/validation.js +52 -0
  163. package/dist/utils/verbosity.d.ts +57 -0
  164. package/dist/utils/verbosity.js +67 -0
  165. package/dist/utils/webui.d.ts +20 -0
  166. package/dist/utils/webui.js +35 -0
  167. 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
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerPauseTools(server: McpServer): void;