foundryvtt-mcp 0.11.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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +142 -0
  3. package/dist/character/manager.d.ts +92 -0
  4. package/dist/character/manager.d.ts.map +1 -0
  5. package/dist/character/manager.js +208 -0
  6. package/dist/character/manager.js.map +1 -0
  7. package/dist/combat/manager.d.ts +94 -0
  8. package/dist/combat/manager.d.ts.map +1 -0
  9. package/dist/combat/manager.js +373 -0
  10. package/dist/combat/manager.js.map +1 -0
  11. package/dist/config/index.d.ts +114 -0
  12. package/dist/config/index.d.ts.map +1 -0
  13. package/dist/config/index.js +177 -0
  14. package/dist/config/index.js.map +1 -0
  15. package/dist/diagnostics/client.d.ts +193 -0
  16. package/dist/diagnostics/client.d.ts.map +1 -0
  17. package/dist/diagnostics/client.js +314 -0
  18. package/dist/diagnostics/client.js.map +1 -0
  19. package/dist/diagnostics/types.d.ts +414 -0
  20. package/dist/diagnostics/types.d.ts.map +1 -0
  21. package/dist/diagnostics/types.js +94 -0
  22. package/dist/diagnostics/types.js.map +1 -0
  23. package/dist/foundry/auth.d.ts +19 -0
  24. package/dist/foundry/auth.d.ts.map +1 -0
  25. package/dist/foundry/auth.js +135 -0
  26. package/dist/foundry/auth.js.map +1 -0
  27. package/dist/foundry/client.d.ts +95 -0
  28. package/dist/foundry/client.d.ts.map +1 -0
  29. package/dist/foundry/client.js +692 -0
  30. package/dist/foundry/client.js.map +1 -0
  31. package/dist/foundry/types.d.ts +805 -0
  32. package/dist/foundry/types.d.ts.map +1 -0
  33. package/dist/foundry/types.js +13 -0
  34. package/dist/foundry/types.js.map +1 -0
  35. package/dist/index.d.ts +16 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +199 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/resources/index.d.ts +3 -0
  40. package/dist/resources/index.d.ts.map +1 -0
  41. package/dist/resources/index.js +93 -0
  42. package/dist/resources/index.js.map +1 -0
  43. package/dist/tools/base.d.ts +80 -0
  44. package/dist/tools/base.d.ts.map +1 -0
  45. package/dist/tools/base.js +73 -0
  46. package/dist/tools/base.js.map +1 -0
  47. package/dist/tools/definitions.d.ts +414 -0
  48. package/dist/tools/definitions.d.ts.map +1 -0
  49. package/dist/tools/definitions.js +429 -0
  50. package/dist/tools/definitions.js.map +1 -0
  51. package/dist/tools/handlers/actors.d.ts +31 -0
  52. package/dist/tools/handlers/actors.d.ts.map +1 -0
  53. package/dist/tools/handlers/actors.js +76 -0
  54. package/dist/tools/handlers/actors.js.map +1 -0
  55. package/dist/tools/handlers/chat.d.ts +13 -0
  56. package/dist/tools/handlers/chat.d.ts.map +1 -0
  57. package/dist/tools/handlers/chat.js +38 -0
  58. package/dist/tools/handlers/chat.js.map +1 -0
  59. package/dist/tools/handlers/combat.d.ts +11 -0
  60. package/dist/tools/handlers/combat.d.ts.map +1 -0
  61. package/dist/tools/handlers/combat.js +48 -0
  62. package/dist/tools/handlers/combat.js.map +1 -0
  63. package/dist/tools/handlers/diagnostics.d.ts +64 -0
  64. package/dist/tools/handlers/diagnostics.d.ts.map +1 -0
  65. package/dist/tools/handlers/diagnostics.js +182 -0
  66. package/dist/tools/handlers/diagnostics.js.map +1 -0
  67. package/dist/tools/handlers/dice.d.ts +39 -0
  68. package/dist/tools/handlers/dice.d.ts.map +1 -0
  69. package/dist/tools/handlers/dice.js +53 -0
  70. package/dist/tools/handlers/dice.js.map +1 -0
  71. package/dist/tools/handlers/generation.d.ts +44 -0
  72. package/dist/tools/handlers/generation.d.ts.map +1 -0
  73. package/dist/tools/handlers/generation.js +205 -0
  74. package/dist/tools/handlers/generation.js.map +1 -0
  75. package/dist/tools/handlers/items.d.ts +21 -0
  76. package/dist/tools/handlers/items.d.ts.map +1 -0
  77. package/dist/tools/handlers/items.js +50 -0
  78. package/dist/tools/handlers/items.js.map +1 -0
  79. package/dist/tools/handlers/journals.d.ts +22 -0
  80. package/dist/tools/handlers/journals.d.ts.map +1 -0
  81. package/dist/tools/handlers/journals.js +62 -0
  82. package/dist/tools/handlers/journals.js.map +1 -0
  83. package/dist/tools/handlers/resources.d.ts +13 -0
  84. package/dist/tools/handlers/resources.d.ts.map +1 -0
  85. package/dist/tools/handlers/resources.js +188 -0
  86. package/dist/tools/handlers/resources.js.map +1 -0
  87. package/dist/tools/handlers/scenes.d.ts +18 -0
  88. package/dist/tools/handlers/scenes.d.ts.map +1 -0
  89. package/dist/tools/handlers/scenes.js +34 -0
  90. package/dist/tools/handlers/scenes.js.map +1 -0
  91. package/dist/tools/handlers/users.d.ts +11 -0
  92. package/dist/tools/handlers/users.d.ts.map +1 -0
  93. package/dist/tools/handlers/users.js +34 -0
  94. package/dist/tools/handlers/users.js.map +1 -0
  95. package/dist/tools/handlers/utils.d.ts +11 -0
  96. package/dist/tools/handlers/utils.d.ts.map +1 -0
  97. package/dist/tools/handlers/utils.js +24 -0
  98. package/dist/tools/handlers/utils.js.map +1 -0
  99. package/dist/tools/handlers/world.d.ts +26 -0
  100. package/dist/tools/handlers/world.d.ts.map +1 -0
  101. package/dist/tools/handlers/world.js +92 -0
  102. package/dist/tools/handlers/world.js.map +1 -0
  103. package/dist/tools/index.d.ts +19 -0
  104. package/dist/tools/index.d.ts.map +1 -0
  105. package/dist/tools/index.js +22 -0
  106. package/dist/tools/index.js.map +1 -0
  107. package/dist/tools/new-router.d.ts +29 -0
  108. package/dist/tools/new-router.d.ts.map +1 -0
  109. package/dist/tools/new-router.js +97 -0
  110. package/dist/tools/new-router.js.map +1 -0
  111. package/dist/tools/registry.d.ts +51 -0
  112. package/dist/tools/registry.d.ts.map +1 -0
  113. package/dist/tools/registry.js +79 -0
  114. package/dist/tools/registry.js.map +1 -0
  115. package/dist/tools/resources.d.ts +16 -0
  116. package/dist/tools/resources.d.ts.map +1 -0
  117. package/dist/tools/resources.js +63 -0
  118. package/dist/tools/resources.js.map +1 -0
  119. package/dist/tools/router.d.ts +22 -0
  120. package/dist/tools/router.d.ts.map +1 -0
  121. package/dist/tools/router.js +128 -0
  122. package/dist/tools/router.js.map +1 -0
  123. package/dist/utils/cache-instance.d.ts +25 -0
  124. package/dist/utils/cache-instance.d.ts.map +1 -0
  125. package/dist/utils/cache-instance.js +30 -0
  126. package/dist/utils/cache-instance.js.map +1 -0
  127. package/dist/utils/cache.d.ts +80 -0
  128. package/dist/utils/cache.d.ts.map +1 -0
  129. package/dist/utils/cache.js +205 -0
  130. package/dist/utils/cache.js.map +1 -0
  131. package/dist/utils/diagnostics.d.ts +114 -0
  132. package/dist/utils/diagnostics.d.ts.map +1 -0
  133. package/dist/utils/diagnostics.js +330 -0
  134. package/dist/utils/diagnostics.js.map +1 -0
  135. package/dist/utils/logger.d.ts +137 -0
  136. package/dist/utils/logger.d.ts.map +1 -0
  137. package/dist/utils/logger.js +158 -0
  138. package/dist/utils/logger.js.map +1 -0
  139. package/package.json +98 -0
@@ -0,0 +1,429 @@
1
+ /**
2
+ * @fileoverview Tool definitions for FoundryVTT MCP Server
3
+ *
4
+ * This module contains all tool schema definitions organized by category.
5
+ * Tools are separated into logical groups for better maintainability.
6
+ */
7
+ /**
8
+ * Dice rolling tool definitions
9
+ */
10
+ export const diceTools = [
11
+ {
12
+ name: 'roll_dice',
13
+ description: 'Roll dice using standard RPG notation (e.g., 1d20, 3d6+4)',
14
+ inputSchema: {
15
+ type: 'object',
16
+ properties: {
17
+ formula: {
18
+ type: 'string',
19
+ description: 'Dice formula (e.g., "1d20+5", "3d6")',
20
+ },
21
+ reason: {
22
+ type: 'string',
23
+ description: 'Optional reason for the roll',
24
+ },
25
+ },
26
+ required: ['formula'],
27
+ },
28
+ },
29
+ ];
30
+ /**
31
+ * Actor management tool definitions
32
+ */
33
+ export const actorTools = [
34
+ {
35
+ name: 'search_actors',
36
+ description: 'Search for actors (characters, NPCs) in FoundryVTT',
37
+ inputSchema: {
38
+ type: 'object',
39
+ properties: {
40
+ query: {
41
+ type: 'string',
42
+ description: 'Search query for actor names',
43
+ },
44
+ type: {
45
+ type: 'string',
46
+ description: 'Actor type filter (character, npc, etc.)',
47
+ },
48
+ limit: {
49
+ type: 'number',
50
+ description: 'Maximum number of results to return',
51
+ default: 10,
52
+ },
53
+ },
54
+ },
55
+ },
56
+ {
57
+ name: 'get_actor_details',
58
+ description: 'Get detailed information about a specific actor',
59
+ inputSchema: {
60
+ type: 'object',
61
+ properties: {
62
+ actorId: {
63
+ type: 'string',
64
+ description: 'The ID of the actor to retrieve',
65
+ },
66
+ },
67
+ required: ['actorId'],
68
+ },
69
+ },
70
+ ];
71
+ /**
72
+ * Item management tool definitions
73
+ */
74
+ export const itemTools = [
75
+ {
76
+ name: 'search_items',
77
+ description: 'Search for items in FoundryVTT',
78
+ inputSchema: {
79
+ type: 'object',
80
+ properties: {
81
+ query: {
82
+ type: 'string',
83
+ description: 'Search query for item names',
84
+ },
85
+ type: {
86
+ type: 'string',
87
+ description: 'Item type filter (weapon, armor, consumable, etc.)',
88
+ },
89
+ rarity: {
90
+ type: 'string',
91
+ description: 'Item rarity filter (common, uncommon, rare, etc.)',
92
+ },
93
+ limit: {
94
+ type: 'number',
95
+ description: 'Maximum number of results to return',
96
+ default: 10,
97
+ },
98
+ },
99
+ },
100
+ },
101
+ ];
102
+ /**
103
+ * Scene management tool definitions
104
+ */
105
+ export const sceneTools = [
106
+ {
107
+ name: 'get_scene_info',
108
+ description: 'Get information about the current or specified scene',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ sceneId: {
113
+ type: 'string',
114
+ description: 'Optional scene ID. If not provided, returns current scene',
115
+ },
116
+ },
117
+ },
118
+ },
119
+ ];
120
+ /**
121
+ * Content generation tool definitions
122
+ */
123
+ export const generationTools = [
124
+ {
125
+ name: 'generate_npc',
126
+ description: 'Generate a random NPC with stats and background',
127
+ inputSchema: {
128
+ type: 'object',
129
+ properties: {
130
+ level: {
131
+ type: 'number',
132
+ description: 'Character level (1-20)',
133
+ minimum: 1,
134
+ maximum: 20,
135
+ default: 1,
136
+ },
137
+ race: {
138
+ type: 'string',
139
+ description: 'Character race (optional)',
140
+ },
141
+ class: {
142
+ type: 'string',
143
+ description: 'Character class (optional)',
144
+ },
145
+ },
146
+ },
147
+ },
148
+ {
149
+ name: 'generate_loot',
150
+ description: 'Generate random loot for encounters',
151
+ inputSchema: {
152
+ type: 'object',
153
+ properties: {
154
+ challengeRating: {
155
+ type: 'number',
156
+ description: 'Challenge rating for loot generation',
157
+ minimum: 0,
158
+ maximum: 30,
159
+ },
160
+ treasureType: {
161
+ type: 'string',
162
+ description: 'Type of treasure (hoard, individual, etc.)',
163
+ },
164
+ },
165
+ },
166
+ },
167
+ {
168
+ name: 'lookup_rule',
169
+ description: 'Look up game rules and mechanics',
170
+ inputSchema: {
171
+ type: 'object',
172
+ properties: {
173
+ query: {
174
+ type: 'string',
175
+ description: 'Rule or mechanic to look up',
176
+ },
177
+ system: {
178
+ type: 'string',
179
+ description: 'Game system (D&D 5e, Pathfinder, etc.)',
180
+ },
181
+ },
182
+ required: ['query'],
183
+ },
184
+ },
185
+ ];
186
+ /**
187
+ * Diagnostics and logging tool definitions
188
+ */
189
+ export const diagnosticsTools = [
190
+ {
191
+ name: 'get_recent_logs',
192
+ description: 'Get recent log entries from FoundryVTT',
193
+ inputSchema: {
194
+ type: 'object',
195
+ properties: {
196
+ limit: {
197
+ type: 'number',
198
+ description: 'Number of log entries to retrieve',
199
+ default: 20,
200
+ minimum: 1,
201
+ maximum: 100,
202
+ },
203
+ level: {
204
+ type: 'string',
205
+ description: 'Log level filter (debug, info, warn, error)',
206
+ enum: ['debug', 'info', 'warn', 'error'],
207
+ },
208
+ since: {
209
+ type: 'string',
210
+ description: 'Get logs since this timestamp (ISO format)',
211
+ },
212
+ },
213
+ },
214
+ },
215
+ {
216
+ name: 'search_logs',
217
+ description: 'Search through FoundryVTT logs',
218
+ inputSchema: {
219
+ type: 'object',
220
+ properties: {
221
+ query: {
222
+ type: 'string',
223
+ description: 'Search query for log contents',
224
+ },
225
+ level: {
226
+ type: 'string',
227
+ description: 'Log level filter',
228
+ enum: ['debug', 'info', 'warn', 'error'],
229
+ },
230
+ limit: {
231
+ type: 'number',
232
+ description: 'Maximum number of results',
233
+ default: 50,
234
+ },
235
+ },
236
+ required: ['query'],
237
+ },
238
+ },
239
+ {
240
+ name: 'get_system_health',
241
+ description: 'Get system health and performance metrics',
242
+ inputSchema: {
243
+ type: 'object',
244
+ properties: {},
245
+ },
246
+ },
247
+ {
248
+ name: 'diagnose_errors',
249
+ description: 'Diagnose and analyze system errors',
250
+ inputSchema: {
251
+ type: 'object',
252
+ properties: {
253
+ category: {
254
+ type: 'string',
255
+ description: 'Error category to focus on',
256
+ },
257
+ },
258
+ },
259
+ },
260
+ {
261
+ name: 'get_health_status',
262
+ description: 'Get comprehensive health status of FoundryVTT server',
263
+ inputSchema: {
264
+ type: 'object',
265
+ properties: {},
266
+ },
267
+ },
268
+ ];
269
+ /**
270
+ * Combat tool definitions
271
+ */
272
+ export const combatTools = [
273
+ {
274
+ name: 'get_combat_state',
275
+ description: 'Get the current active combat state including initiative order, HP, and AC',
276
+ inputSchema: {
277
+ type: 'object',
278
+ properties: {},
279
+ },
280
+ },
281
+ ];
282
+ /**
283
+ * Chat message tool definitions
284
+ */
285
+ export const chatTools = [
286
+ {
287
+ name: 'get_chat_messages',
288
+ description: 'Get recent chat messages from the game',
289
+ inputSchema: {
290
+ type: 'object',
291
+ properties: {
292
+ limit: {
293
+ type: 'number',
294
+ description: 'Number of messages to retrieve (default 20)',
295
+ default: 20,
296
+ minimum: 1,
297
+ maximum: 100,
298
+ },
299
+ },
300
+ },
301
+ },
302
+ ];
303
+ /**
304
+ * User tool definitions
305
+ */
306
+ export const userTools = [
307
+ {
308
+ name: 'get_users',
309
+ description: 'Get the list of users with their online status and roles',
310
+ inputSchema: {
311
+ type: 'object',
312
+ properties: {},
313
+ },
314
+ },
315
+ ];
316
+ /**
317
+ * Journal tool definitions
318
+ */
319
+ export const journalTools = [
320
+ {
321
+ name: 'search_journals',
322
+ description: 'Search journal entries by name or content',
323
+ inputSchema: {
324
+ type: 'object',
325
+ properties: {
326
+ query: {
327
+ type: 'string',
328
+ description: 'Search query for journal names and content',
329
+ },
330
+ limit: {
331
+ type: 'number',
332
+ description: 'Maximum number of results',
333
+ default: 10,
334
+ },
335
+ },
336
+ required: ['query'],
337
+ },
338
+ },
339
+ {
340
+ name: 'get_journal',
341
+ description: 'Get a specific journal entry with its pages',
342
+ inputSchema: {
343
+ type: 'object',
344
+ properties: {
345
+ journalId: {
346
+ type: 'string',
347
+ description: 'The ID of the journal entry to retrieve',
348
+ },
349
+ },
350
+ required: ['journalId'],
351
+ },
352
+ },
353
+ ];
354
+ /**
355
+ * World-level tool definitions
356
+ */
357
+ export const worldTools = [
358
+ {
359
+ name: 'search_world',
360
+ description: 'Search across all collections (actors, items, scenes, journals) by name',
361
+ inputSchema: {
362
+ type: 'object',
363
+ properties: {
364
+ query: {
365
+ type: 'string',
366
+ description: 'Search query to match against entity names',
367
+ },
368
+ limit: {
369
+ type: 'number',
370
+ description: 'Maximum results per collection (default 5)',
371
+ default: 5,
372
+ },
373
+ },
374
+ required: ['query'],
375
+ },
376
+ },
377
+ {
378
+ name: 'get_world_summary',
379
+ description: 'Get world metadata and collection counts',
380
+ inputSchema: {
381
+ type: 'object',
382
+ properties: {},
383
+ },
384
+ },
385
+ {
386
+ name: 'refresh_world_data',
387
+ description: 'Force re-fetch of world data from the FoundryVTT server',
388
+ inputSchema: {
389
+ type: 'object',
390
+ properties: {},
391
+ },
392
+ },
393
+ ];
394
+ /**
395
+ * Get all tool definitions combined
396
+ */
397
+ export function getAllTools() {
398
+ return [
399
+ ...diceTools,
400
+ ...actorTools,
401
+ ...itemTools,
402
+ ...sceneTools,
403
+ ...combatTools,
404
+ ...chatTools,
405
+ ...userTools,
406
+ ...journalTools,
407
+ ...worldTools,
408
+ ...generationTools,
409
+ ...diagnosticsTools,
410
+ ];
411
+ }
412
+ /**
413
+ * Get modernized tool definitions from registry (when available)
414
+ */
415
+ export async function getModernizedTools() {
416
+ try {
417
+ const { toolRegistry } = await import('./registry.js');
418
+ const modernTools = toolRegistry.getToolDefinitions();
419
+ // Filter out tools that have been modernized to avoid duplicates
420
+ const modernToolNames = new Set(modernTools.map((tool) => tool.name));
421
+ const legacyTools = getAllTools().filter((tool) => !modernToolNames.has(tool.name));
422
+ return [...modernTools, ...legacyTools];
423
+ }
424
+ catch (_error) {
425
+ // Fallback to legacy definitions if registry is not available
426
+ return getAllTools();
427
+ }
428
+ }
429
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0CAA0C;iBACxD;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,E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tC,IAAI,CAAC;QACH,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,YAAY,CAAC,kBAAkB,EAAE,CAAC;QAEtD,iEAAiE;QACjE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEpF,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,8DAA8D;QAC9D,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @fileoverview Actor management tool handlers
3
+ *
4
+ * Handles searching for actors and retrieving detailed actor information.
5
+ */
6
+ import type { FoundryClient } from '../../foundry/client.js';
7
+ /**
8
+ * Handles actor search requests
9
+ */
10
+ export declare function handleSearchActors(args: {
11
+ query?: string;
12
+ type?: string;
13
+ limit?: number;
14
+ }, foundryClient: FoundryClient): Promise<{
15
+ content: {
16
+ type: string;
17
+ text: string;
18
+ }[];
19
+ }>;
20
+ /**
21
+ * Handles detailed actor information requests
22
+ */
23
+ export declare function handleGetActorDetails(args: {
24
+ actorId: string;
25
+ }, foundryClient: FoundryClient): Promise<{
26
+ content: {
27
+ type: string;
28
+ text: string;
29
+ }[];
30
+ }>;
31
+ //# sourceMappingURL=actors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/actors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE;IACJ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EACD,aAAa,EAAE,aAAa;;;;;GAqC7B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;CACjB,EACD,aAAa,EAAE,aAAa;;;;;GAsC7B"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @fileoverview Actor management tool handlers
3
+ *
4
+ * Handles searching for actors and retrieving detailed actor information.
5
+ */
6
+ import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
7
+ import { withToolError } from './utils.js';
8
+ /**
9
+ * Handles actor search requests
10
+ */
11
+ export async function handleSearchActors(args, foundryClient) {
12
+ const { query, type, limit = 10 } = args;
13
+ return withToolError('search actors', async () => {
14
+ const searchParams = {
15
+ query: query || '',
16
+ limit,
17
+ };
18
+ if (type) {
19
+ searchParams.type = type;
20
+ }
21
+ const result = await foundryClient.searchActors(searchParams);
22
+ const actorList = result.actors
23
+ .map((actor) => `- **${actor.name}** (${actor.type}) - Level ${actor.level || 'Unknown'} - HP: ${actor.hp?.value || 'Unknown'}/${actor.hp?.max || 'Unknown'}`)
24
+ .join('\n');
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: `🎭 **Actor Search Results**
30
+ **Query:** ${query || 'All actors'}
31
+ **Type Filter:** ${type || 'All types'}
32
+ **Results:** ${result.actors.length}/${result.total} total
33
+
34
+ ${actorList || 'No actors found matching the criteria.'}
35
+
36
+ **Page:** ${result.page} | **Limit:** ${result.limit}`,
37
+ },
38
+ ],
39
+ };
40
+ });
41
+ }
42
+ /**
43
+ * Handles detailed actor information requests
44
+ */
45
+ export async function handleGetActorDetails(args, foundryClient) {
46
+ const { actorId } = args;
47
+ if (!actorId || typeof actorId !== 'string') {
48
+ throw new McpError(ErrorCode.InvalidParams, 'Actor ID is required and must be a string');
49
+ }
50
+ return withToolError('get actor details', async () => {
51
+ const actor = await foundryClient.getActor(actorId);
52
+ const abilities = actor.abilities
53
+ ? Object.entries(actor.abilities)
54
+ .map(([key, ability]) => `**${key.toUpperCase()}:** ${ability.value} (${ability.mod >= 0 ? '+' : ''}${ability.mod})`)
55
+ .join('\n')
56
+ : 'No ability scores available';
57
+ return {
58
+ content: [
59
+ {
60
+ type: 'text',
61
+ text: `🎭 **Actor Details: ${actor.name}**
62
+ **Type:** ${actor.type}
63
+ **Level:** ${actor.level || 'Unknown'}
64
+ **Hit Points:** ${actor.hp?.value || 'Unknown'}/${actor.hp?.max || 'Unknown'}
65
+ **Armor Class:** ${actor.ac?.value || 'Unknown'}
66
+
67
+ **Ability Scores:**
68
+ ${abilities}
69
+
70
+ **Description:** ${actor.description || 'No description available.'}`,
71
+ },
72
+ ],
73
+ };
74
+ });
75
+ }
76
+ //# sourceMappingURL=actors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actors.js","sourceRoot":"","sources":["../../../src/tools/handlers/actors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAIC,EACD,aAA4B;IAE5B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IAEzC,OAAO,aAAa,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,YAAY,GAAoD;YACpE,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,KAAK;SACN,CAAC;QACF,IAAI,IAAI,EAAE,CAAC;YACT,Y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AAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;iBAC5B,GAAG,CACF,CAAC,CAAC,GAAG,EAAE,OAAO,CAA2C,EAAE,EAAE,CAC3D,KAAK,GAAG,CAAC,WAAW,EAAE,OAAO,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,GAAG,CAC9F;iBACA,IAAI,CAAC,IAAI,CAAC;YACf,CAAC,CAAC,6BAA6B,CAAC;QAElC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uBAAuB,KAAK,CAAC,IAAI;YACrC,KAAK,CAAC,IAAI;aACT,KAAK,CAAC,KAAK,IAAI,SAAS;kBACnB,KAAK,CAAC,EAAE,EAAE,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC,EAAE,EAAE,GAAG,IAAI,SAAS;mBACzD,KAAK,CAAC,EAAE,EAAE,KAAK,IAAI,SAAS;;;EAG7C,SAAS;;mBAES,KAAkC,CAAC,WAAW,IAAI,2BAA2B,EAAE;iBAC1F;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Chat message tool handler
3
+ */
4
+ import type { FoundryClient } from '../../foundry/client.js';
5
+ export declare function handleGetChatMessages(args: {
6
+ limit?: number;
7
+ }, foundryClient: FoundryClient): Promise<{
8
+ content: {
9
+ type: string;
10
+ text: string;
11
+ }[];
12
+ }>;
13
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/chat.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,wBAAsB,qBAAqB,CACzC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACxB,aAAa,EAAE,aAAa;;;;;GAqC7B"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Chat message tool handler
3
+ */
4
+ import { withToolError } from './utils.js';
5
+ export async function handleGetChatMessages(args, foundryClient) {
6
+ return withToolError('get chat messages', async () => {
7
+ const limit = args.limit || 20;
8
+ const messages = foundryClient.getChatMessages(limit);
9
+ if (messages.length === 0) {
10
+ return {
11
+ content: [{ type: 'text', text: 'No chat messages found.' }],
12
+ };
13
+ }
14
+ // Resolve user names from worldData
15
+ const { users } = foundryClient.getUsers();
16
+ const userMap = new Map(users.map((u) => [u._id, u.name]));
17
+ const formatted = messages
18
+ .map((m) => {
19
+ const speaker = m.speaker?.alias || userMap.get(m.user) || 'Unknown';
20
+ const time = new Date(m.timestamp).toLocaleTimeString();
21
+ const content = m.content
22
+ .replace(/<[^>]+>/g, '')
23
+ .trim()
24
+ .slice(0, 200);
25
+ return `[${time}] **${speaker}**: ${content}`;
26
+ })
27
+ .join('\n');
28
+ return {
29
+ content: [
30
+ {
31
+ type: 'text',
32
+ text: `**Recent Chat Messages** (${messages.length})\n\n${formatted}`,
33
+ },
34
+ ],
35
+ };
36
+ });
37
+ }
38
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/tools/handlers/chat.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAwB,EACxB,aAA4B;IAE5B,OAAO,aAAa,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAEtD,IAA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} from '../../foundry/client.js';
5
+ export declare function handleGetCombatState(_args: Record<string, unknown>, foundryClient: FoundryClient): Promise<{
6
+ content: {
7
+ type: string;
8
+ text: string;
9
+ }[];
10
+ }>;
11
+ //# sourceMappingURL=combat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combat.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/combat.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,aAAa,EAAE,aAAa;;;;;GAgD7B"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Combat state tool handler
3
+ */
4
+ import { withToolError } from './utils.js';
5
+ export async function handleGetCombatState(_args, foundryClient) {
6
+ return withToolError('get combat state', async () => {
7
+ const combat = foundryClient.getCombatState();
8
+ if (!combat) {
9
+ return {
10
+ content: [{ type: 'text', text: 'No active combat encounter.' }],
11
+ };
12
+ }
13
+ const combatants = combat.combatants
14
+ .sort((a, b) => (b.initiative ?? -999) - (a.initiative ?? -999))
15
+ .map((c, i) => {
16
+ const current = combat.turn === i ? ' <-- CURRENT' : '';
17
+ const status = c.defeated ? ' [DEFEATED]' : c.hidden ? ' [HIDDEN]' : '';
18
+ const init = c.initiative !== null ? c.initiative.toString() : '?';
19
+ // Try to get HP/AC from worldData if actor is linked
20
+ let hpAc = '';
21
+ if (c.actorId) {
22
+ const actor = foundryClient.getRawActor(c.actorId);
23
+ if (actor) {
24
+ const hp = actor.system?.attributes;
25
+ const hpData = hp?.hp;
26
+ const acData = hp?.ac;
27
+ if (hpData) {
28
+ hpAc += ` HP: ${hpData.value ?? '?'}/${hpData.max ?? '?'}`;
29
+ }
30
+ if (acData) {
31
+ hpAc += ` AC: ${acData.value ?? '?'}`;
32
+ }
33
+ }
34
+ }
35
+ return `${i + 1}. [${init}] **${c.name}**${hpAc}${status}${current}`;
36
+ })
37
+ .join('\n');
38
+ return {
39
+ content: [
40
+ {
41
+ type: 'text',
42
+ text: `**Active Combat** — Round ${combat.round}\n\n${combatants}`,
43
+ },
44
+ ],
45
+ };
46
+ });
47
+ }
48
+ //# sourceMappingURL=combat.js.map