run-dmcp 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.js ADDED
@@ -0,0 +1,20 @@
1
+ // The core assembly: the MCP server built from the core's tools.
2
+ //
3
+ // This is a SEPARATE entry point (`run-dmcp/server`) from the core library
4
+ // (`run-dmcp`, src/index.ts) for one reason, and it is a cost. Building a
5
+ // server means loading the MCP SDK and twenty-one register modules; wanting
6
+ // `LIMITS` or `createGame` does not. While these lived on the same entry,
7
+ // every consumer paid for both -- 97.4ms per process against 46.8ms for the
8
+ // mechanism alone, measured cold at 0.3.0 over nine spawns, on a consumer
9
+ // that spawns a fresh process per turn and never calls this function.
10
+ //
11
+ // The split is a move, not a change: `createCoreMcpServer` is the same
12
+ // function with the same options, reached by a different specifier.
13
+ // src/__tests__/assemblyBoundary.test.ts asserts that it stays reachable
14
+ // from here, and unreachable from there.
15
+ //
16
+ // Importing this module must still do nothing to the machine -- the rule
17
+ // src/index.ts's header states applies to every library entry this package
18
+ // publishes, and src/__tests__/entrypoints.test.ts holds it. Starting things
19
+ // is src/bin/run-dmcp.ts.
20
+ export { createCoreMcpServer, SERVER_NAME, SERVER_VERSION } from "./mcp-server.js";
@@ -47,14 +47,14 @@ export declare const gameStateOutputSchema: {
47
47
  setting: z.ZodString;
48
48
  style: z.ZodString;
49
49
  }, "strip", z.ZodTypeAny, {
50
- setting: string;
51
50
  id: string;
52
51
  name: string;
52
+ setting: string;
53
53
  style: string;
54
54
  }, {
55
- setting: string;
56
55
  id: string;
57
56
  name: string;
57
+ setting: string;
58
58
  style: string;
59
59
  }>;
60
60
  characterCount: z.ZodNumber;
@@ -73,17 +73,17 @@ export declare const gameMenuOutputSchema: {
73
73
  updatedAt: z.ZodString;
74
74
  webUiUrl: z.ZodOptional<z.ZodString>;
75
75
  }, "strip", z.ZodTypeAny, {
76
- setting: string;
77
76
  id: string;
78
77
  name: string;
78
+ setting: string;
79
79
  createdAt: string;
80
80
  style: string;
81
81
  updatedAt: string;
82
82
  webUiUrl?: string | undefined;
83
83
  }, {
84
- setting: string;
85
84
  id: string;
86
85
  name: string;
86
+ setting: string;
87
87
  createdAt: string;
88
88
  style: string;
89
89
  updatedAt: string;
@@ -187,8 +187,8 @@ export declare const characterOutputSchema: {
187
187
  distinguishingMarks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
188
188
  }, "strip", z.ZodTypeAny, {
189
189
  height?: string | undefined;
190
- age?: string | undefined;
191
190
  gender?: string | undefined;
191
+ age?: string | undefined;
192
192
  bodyType?: string | undefined;
193
193
  skinTone?: string | undefined;
194
194
  hairColor?: string | undefined;
@@ -198,8 +198,8 @@ export declare const characterOutputSchema: {
198
198
  distinguishingMarks?: string[] | undefined;
199
199
  }, {
200
200
  height?: string | undefined;
201
- age?: string | undefined;
202
201
  gender?: string | undefined;
202
+ age?: string | undefined;
203
203
  bodyType?: string | undefined;
204
204
  skinTone?: string | undefined;
205
205
  hairColor?: string | undefined;
@@ -238,16 +238,16 @@ export declare const characterOutputSchema: {
238
238
  weather?: string | undefined;
239
239
  lighting?: string | undefined;
240
240
  architecture?: string | undefined;
241
- vegetation?: string | undefined;
242
241
  notableFeatures?: string[] | undefined;
242
+ vegetation?: string | undefined;
243
243
  }, {
244
244
  setting: string;
245
245
  timeOfDay?: string | undefined;
246
246
  weather?: string | undefined;
247
247
  lighting?: string | undefined;
248
248
  architecture?: string | undefined;
249
- vegetation?: string | undefined;
250
249
  notableFeatures?: string[] | undefined;
250
+ vegetation?: string | undefined;
251
251
  }>>;
252
252
  objectDetails: z.ZodOptional<z.ZodObject<{
253
253
  material: z.ZodOptional<z.ZodString>;
@@ -273,8 +273,8 @@ export declare const characterOutputSchema: {
273
273
  primaryDescription: string;
274
274
  physicalTraits?: {
275
275
  height?: string | undefined;
276
- age?: string | undefined;
277
276
  gender?: string | undefined;
277
+ age?: string | undefined;
278
278
  bodyType?: string | undefined;
279
279
  skinTone?: string | undefined;
280
280
  hairColor?: string | undefined;
@@ -295,8 +295,8 @@ export declare const characterOutputSchema: {
295
295
  weather?: string | undefined;
296
296
  lighting?: string | undefined;
297
297
  architecture?: string | undefined;
298
- vegetation?: string | undefined;
299
298
  notableFeatures?: string[] | undefined;
299
+ vegetation?: string | undefined;
300
300
  } | undefined;
301
301
  objectDetails?: {
302
302
  size?: string | undefined;
@@ -312,8 +312,8 @@ export declare const characterOutputSchema: {
312
312
  primaryDescription: string;
313
313
  physicalTraits?: {
314
314
  height?: string | undefined;
315
- age?: string | undefined;
316
315
  gender?: string | undefined;
316
+ age?: string | undefined;
317
317
  bodyType?: string | undefined;
318
318
  skinTone?: string | undefined;
319
319
  hairColor?: string | undefined;
@@ -334,8 +334,8 @@ export declare const characterOutputSchema: {
334
334
  weather?: string | undefined;
335
335
  lighting?: string | undefined;
336
336
  architecture?: string | undefined;
337
- vegetation?: string | undefined;
338
337
  notableFeatures?: string[] | undefined;
338
+ vegetation?: string | undefined;
339
339
  } | undefined;
340
340
  objectDetails?: {
341
341
  size?: string | undefined;
@@ -360,16 +360,16 @@ export declare const characterOutputSchema: {
360
360
  artisticStyle: string;
361
361
  mood: string;
362
362
  colorScheme?: string | undefined;
363
- qualityTags?: string[] | undefined;
364
363
  influences?: string[] | undefined;
364
+ qualityTags?: string[] | undefined;
365
365
  negativeElements?: string[] | undefined;
366
366
  }, {
367
367
  genre: string;
368
368
  artisticStyle: string;
369
369
  mood: string;
370
370
  colorScheme?: string | undefined;
371
- qualityTags?: string[] | undefined;
372
371
  influences?: string[] | undefined;
372
+ qualityTags?: string[] | undefined;
373
373
  negativeElements?: string[] | undefined;
374
374
  }>;
375
375
  composition: z.ZodObject<{
@@ -382,15 +382,15 @@ export declare const characterOutputSchema: {
382
382
  }, "strip", z.ZodTypeAny, {
383
383
  framing: string;
384
384
  background?: string | undefined;
385
- aspectRatio?: string | undefined;
386
385
  cameraAngle?: string | undefined;
386
+ aspectRatio?: string | undefined;
387
387
  focusPoint?: string | undefined;
388
388
  depth?: string | undefined;
389
389
  }, {
390
390
  framing: string;
391
391
  background?: string | undefined;
392
- aspectRatio?: string | undefined;
393
392
  cameraAngle?: string | undefined;
393
+ aspectRatio?: string | undefined;
394
394
  focusPoint?: string | undefined;
395
395
  depth?: string | undefined;
396
396
  }>;
@@ -408,11 +408,11 @@ export declare const characterOutputSchema: {
408
408
  name: z.ZodString;
409
409
  weight: z.ZodNumber;
410
410
  }, "strip", z.ZodTypeAny, {
411
- weight: number;
412
411
  name: string;
413
- }, {
414
412
  weight: number;
413
+ }, {
415
414
  name: string;
415
+ weight: number;
416
416
  }>, "many">>;
417
417
  samplerSettings: z.ZodOptional<z.ZodObject<{
418
418
  sampler: z.ZodOptional<z.ZodString>;
@@ -435,8 +435,8 @@ export declare const characterOutputSchema: {
435
435
  negative: string;
436
436
  checkpoint?: string | undefined;
437
437
  loras?: {
438
- weight: number;
439
438
  name: string;
439
+ weight: number;
440
440
  }[] | undefined;
441
441
  samplerSettings?: {
442
442
  sampler?: string | undefined;
@@ -449,8 +449,8 @@ export declare const characterOutputSchema: {
449
449
  negative: string;
450
450
  checkpoint?: string | undefined;
451
451
  loras?: {
452
- weight: number;
453
452
  name: string;
453
+ weight: number;
454
454
  }[] | undefined;
455
455
  samplerSettings?: {
456
456
  sampler?: string | undefined;
@@ -468,8 +468,8 @@ export declare const characterOutputSchema: {
468
468
  negative: string;
469
469
  checkpoint?: string | undefined;
470
470
  loras?: {
471
- weight: number;
472
471
  name: string;
472
+ weight: number;
473
473
  }[] | undefined;
474
474
  samplerSettings?: {
475
475
  sampler?: string | undefined;
@@ -489,8 +489,8 @@ export declare const characterOutputSchema: {
489
489
  negative: string;
490
490
  checkpoint?: string | undefined;
491
491
  loras?: {
492
- weight: number;
493
492
  name: string;
493
+ weight: number;
494
494
  }[] | undefined;
495
495
  samplerSettings?: {
496
496
  sampler?: string | undefined;
@@ -513,22 +513,22 @@ export declare const characterOutputSchema: {
513
513
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
514
514
  }, "strip", z.ZodTypeAny, {
515
515
  id: string;
516
- tool: string;
517
- prompt: string;
518
516
  timestamp: string;
517
+ prompt: string;
518
+ tool: string;
519
519
  url?: string | undefined;
520
520
  base64?: string | undefined;
521
- seed?: number | undefined;
522
521
  metadata?: Record<string, unknown> | undefined;
522
+ seed?: number | undefined;
523
523
  }, {
524
524
  id: string;
525
- tool: string;
526
- prompt: string;
527
525
  timestamp: string;
526
+ prompt: string;
527
+ tool: string;
528
528
  url?: string | undefined;
529
529
  base64?: string | undefined;
530
- seed?: number | undefined;
531
530
  metadata?: Record<string, unknown> | undefined;
531
+ seed?: number | undefined;
532
532
  }>, "many">>;
533
533
  consistency: z.ZodOptional<z.ZodObject<{
534
534
  characterRef: z.ZodOptional<z.ZodString>;
@@ -552,8 +552,8 @@ export declare const characterOutputSchema: {
552
552
  artisticStyle: string;
553
553
  mood: string;
554
554
  colorScheme?: string | undefined;
555
- qualityTags?: string[] | undefined;
556
555
  influences?: string[] | undefined;
556
+ qualityTags?: string[] | undefined;
557
557
  negativeElements?: string[] | undefined;
558
558
  };
559
559
  subject: {
@@ -561,8 +561,8 @@ export declare const characterOutputSchema: {
561
561
  primaryDescription: string;
562
562
  physicalTraits?: {
563
563
  height?: string | undefined;
564
- age?: string | undefined;
565
564
  gender?: string | undefined;
565
+ age?: string | undefined;
566
566
  bodyType?: string | undefined;
567
567
  skinTone?: string | undefined;
568
568
  hairColor?: string | undefined;
@@ -583,8 +583,8 @@ export declare const characterOutputSchema: {
583
583
  weather?: string | undefined;
584
584
  lighting?: string | undefined;
585
585
  architecture?: string | undefined;
586
- vegetation?: string | undefined;
587
586
  notableFeatures?: string[] | undefined;
587
+ vegetation?: string | undefined;
588
588
  } | undefined;
589
589
  objectDetails?: {
590
590
  size?: string | undefined;
@@ -599,8 +599,8 @@ export declare const characterOutputSchema: {
599
599
  composition: {
600
600
  framing: string;
601
601
  background?: string | undefined;
602
- aspectRatio?: string | undefined;
603
602
  cameraAngle?: string | undefined;
603
+ aspectRatio?: string | undefined;
604
604
  focusPoint?: string | undefined;
605
605
  depth?: string | undefined;
606
606
  };
@@ -619,8 +619,8 @@ export declare const characterOutputSchema: {
619
619
  negative: string;
620
620
  checkpoint?: string | undefined;
621
621
  loras?: {
622
- weight: number;
623
622
  name: string;
623
+ weight: number;
624
624
  }[] | undefined;
625
625
  samplerSettings?: {
626
626
  sampler?: string | undefined;
@@ -634,13 +634,13 @@ export declare const characterOutputSchema: {
634
634
  } | undefined;
635
635
  generations?: {
636
636
  id: string;
637
- tool: string;
638
- prompt: string;
639
637
  timestamp: string;
638
+ prompt: string;
639
+ tool: string;
640
640
  url?: string | undefined;
641
641
  base64?: string | undefined;
642
- seed?: number | undefined;
643
642
  metadata?: Record<string, unknown> | undefined;
643
+ seed?: number | undefined;
644
644
  }[] | undefined;
645
645
  }, {
646
646
  style: {
@@ -648,8 +648,8 @@ export declare const characterOutputSchema: {
648
648
  artisticStyle: string;
649
649
  mood: string;
650
650
  colorScheme?: string | undefined;
651
- qualityTags?: string[] | undefined;
652
651
  influences?: string[] | undefined;
652
+ qualityTags?: string[] | undefined;
653
653
  negativeElements?: string[] | undefined;
654
654
  };
655
655
  subject: {
@@ -657,8 +657,8 @@ export declare const characterOutputSchema: {
657
657
  primaryDescription: string;
658
658
  physicalTraits?: {
659
659
  height?: string | undefined;
660
- age?: string | undefined;
661
660
  gender?: string | undefined;
661
+ age?: string | undefined;
662
662
  bodyType?: string | undefined;
663
663
  skinTone?: string | undefined;
664
664
  hairColor?: string | undefined;
@@ -679,8 +679,8 @@ export declare const characterOutputSchema: {
679
679
  weather?: string | undefined;
680
680
  lighting?: string | undefined;
681
681
  architecture?: string | undefined;
682
- vegetation?: string | undefined;
683
682
  notableFeatures?: string[] | undefined;
683
+ vegetation?: string | undefined;
684
684
  } | undefined;
685
685
  objectDetails?: {
686
686
  size?: string | undefined;
@@ -695,8 +695,8 @@ export declare const characterOutputSchema: {
695
695
  composition: {
696
696
  framing: string;
697
697
  background?: string | undefined;
698
- aspectRatio?: string | undefined;
699
698
  cameraAngle?: string | undefined;
699
+ aspectRatio?: string | undefined;
700
700
  focusPoint?: string | undefined;
701
701
  depth?: string | undefined;
702
702
  };
@@ -715,8 +715,8 @@ export declare const characterOutputSchema: {
715
715
  negative: string;
716
716
  checkpoint?: string | undefined;
717
717
  loras?: {
718
- weight: number;
719
718
  name: string;
719
+ weight: number;
720
720
  }[] | undefined;
721
721
  samplerSettings?: {
722
722
  sampler?: string | undefined;
@@ -730,13 +730,13 @@ export declare const characterOutputSchema: {
730
730
  } | undefined;
731
731
  generations?: {
732
732
  id: string;
733
- tool: string;
734
- prompt: string;
735
733
  timestamp: string;
734
+ prompt: string;
735
+ tool: string;
736
736
  url?: string | undefined;
737
737
  base64?: string | undefined;
738
- seed?: number | undefined;
739
738
  metadata?: Record<string, unknown> | undefined;
739
+ seed?: number | undefined;
740
740
  }[] | undefined;
741
741
  }>>;
742
742
  createdAt: z.ZodString;
@@ -867,13 +867,13 @@ export declare const locationListOutputSchema: {
867
867
  name: z.ZodString;
868
868
  description: z.ZodString;
869
869
  }, "strip", z.ZodTypeAny, {
870
- description: string;
871
870
  id: string;
872
871
  name: string;
873
- }, {
874
872
  description: string;
873
+ }, {
875
874
  id: string;
876
875
  name: string;
876
+ description: string;
877
877
  }>, "many">;
878
878
  count: z.ZodNumber;
879
879
  };
@@ -883,14 +883,14 @@ export declare const questObjectiveSchema: z.ZodObject<{
883
883
  completed: z.ZodBoolean;
884
884
  optional: z.ZodOptional<z.ZodBoolean>;
885
885
  }, "strip", z.ZodTypeAny, {
886
+ id: string;
886
887
  description: string;
887
888
  completed: boolean;
888
- id: string;
889
889
  optional?: boolean | undefined;
890
890
  }, {
891
+ id: string;
891
892
  description: string;
892
893
  completed: boolean;
893
- id: string;
894
894
  optional?: boolean | undefined;
895
895
  }>;
896
896
  export declare const questOutputSchema: {
@@ -904,14 +904,14 @@ export declare const questOutputSchema: {
904
904
  completed: z.ZodBoolean;
905
905
  optional: z.ZodOptional<z.ZodBoolean>;
906
906
  }, "strip", z.ZodTypeAny, {
907
+ id: string;
907
908
  description: string;
908
909
  completed: boolean;
909
- id: string;
910
910
  optional?: boolean | undefined;
911
911
  }, {
912
+ id: string;
912
913
  description: string;
913
914
  completed: boolean;
914
- id: string;
915
915
  optional?: boolean | undefined;
916
916
  }>, "many">;
917
917
  status: z.ZodEnum<["active", "completed", "failed", "abandoned"]>;
@@ -998,14 +998,14 @@ export declare const itemOutputSchema: {
998
998
  }, "strip", z.ZodTypeAny, {
999
999
  description: string;
1000
1000
  type: string;
1001
- weight?: number | undefined;
1002
1001
  value?: number | undefined;
1002
+ weight?: number | undefined;
1003
1003
  effects?: string[] | undefined;
1004
1004
  }, {
1005
1005
  description: string;
1006
1006
  type: string;
1007
- weight?: number | undefined;
1008
1007
  value?: number | undefined;
1008
+ weight?: number | undefined;
1009
1009
  effects?: string[] | undefined;
1010
1010
  }>;
1011
1011
  };
@@ -1087,20 +1087,20 @@ export declare const mapOutputSchema: {
1087
1087
  destinationId: string;
1088
1088
  }>, "many">;
1089
1089
  }, "strip", z.ZodTypeAny, {
1090
+ id: string;
1091
+ name: string;
1090
1092
  exits: {
1091
1093
  direction: string;
1092
1094
  destinationId: string;
1093
1095
  }[];
1094
- id: string;
1095
- name: string;
1096
1096
  hasPlayer: boolean;
1097
1097
  }, {
1098
+ id: string;
1099
+ name: string;
1098
1100
  exits: {
1099
1101
  direction: string;
1100
1102
  destinationId: string;
1101
1103
  }[];
1102
- id: string;
1103
- name: string;
1104
1104
  hasPlayer: boolean;
1105
1105
  }>, "many">;
1106
1106
  connections: z.ZodArray<z.ZodObject<{
@@ -1108,13 +1108,13 @@ export declare const mapOutputSchema: {
1108
1108
  to: z.ZodString;
1109
1109
  direction: z.ZodString;
1110
1110
  }, "strip", z.ZodTypeAny, {
1111
- direction: string;
1112
1111
  from: string;
1113
1112
  to: string;
1114
- }, {
1115
1113
  direction: string;
1114
+ }, {
1116
1115
  from: string;
1117
1116
  to: string;
1117
+ direction: string;
1118
1118
  }>, "many">;
1119
1119
  bounds: z.ZodObject<{
1120
1120
  minX: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run-dmcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "An MCP server for LLM-run interactive fiction where the server owns what is true - including when it was true. A continuation of DMCP.",
5
5
  "license": "MIT",
6
6
  "author": "Derek Ferguson",
@@ -16,10 +16,18 @@
16
16
  "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.js"
18
18
  },
19
+ "./server": {
20
+ "types": "./dist/server.d.ts",
21
+ "default": "./dist/server.js"
22
+ },
19
23
  "./rpg": {
20
24
  "types": "./dist/rpg/index.d.ts",
21
25
  "default": "./dist/rpg/index.js"
22
26
  },
27
+ "./rpg/server": {
28
+ "types": "./dist/rpg/server.d.ts",
29
+ "default": "./dist/rpg/server.js"
30
+ },
23
31
  "./package.json": "./package.json"
24
32
  },
25
33
  "bin": {
@@ -1,2 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerAbilityTools(server: McpServer): void;
@@ -1,165 +0,0 @@
1
- import { z } from "zod";
2
- import * as abilityTools from "../tools/ability.js";
3
- import { LIMITS } from "../utils/validation.js";
4
- import { ANNOTATIONS } from "../utils/tool-annotations.js";
5
- export function registerAbilityTools(server) {
6
- server.registerTool("create_ability", {
7
- description: "Create an ability template or character-owned ability",
8
- inputSchema: {
9
- gameId: z.string().max(100).describe("The game ID"),
10
- ownerType: z.enum(["template", "character"]).describe("'template' for reusable, 'character' for owned"),
11
- ownerId: z.string().max(100).optional().describe("Character ID if ownerType is 'character'"),
12
- name: z.string().min(1).max(LIMITS.NAME_MAX).describe("Ability name"),
13
- description: z.string().max(LIMITS.DESCRIPTION_MAX).optional().describe("Ability description"),
14
- category: z.string().max(100).optional().describe("Category (e.g., 'spell', 'skill', 'power')"),
15
- cost: z.record(z.number()).optional().describe("Resource costs (e.g., {mana: 10, stamina: 5})"),
16
- cooldown: z.number().optional().describe("Cooldown in rounds"),
17
- effects: z.array(z.string().max(LIMITS.DESCRIPTION_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Effect descriptions"),
18
- requirements: z.record(z.number()).optional().describe("Requirements (e.g., {level: 5, strength: 10})"),
19
- tags: z.array(z.string().max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("Tags for categorization"),
20
- },
21
- annotations: ANNOTATIONS.CREATE,
22
- }, async (params) => {
23
- const ability = abilityTools.createAbility(params);
24
- return {
25
- content: [{ type: "text", text: JSON.stringify(ability, null, 2) }],
26
- };
27
- });
28
- server.registerTool("get_ability", {
29
- description: "Get an ability by ID",
30
- inputSchema: {
31
- abilityId: z.string().max(100).describe("The ability ID"),
32
- },
33
- annotations: ANNOTATIONS.READ_ONLY,
34
- }, async ({ abilityId }) => {
35
- const ability = abilityTools.getAbility(abilityId);
36
- if (!ability) {
37
- return {
38
- content: [{ type: "text", text: "Ability not found" }],
39
- isError: true,
40
- };
41
- }
42
- return {
43
- content: [{ type: "text", text: JSON.stringify(ability, null, 2) }],
44
- };
45
- });
46
- server.registerTool("update_ability", {
47
- description: "Update an ability's details",
48
- inputSchema: {
49
- abilityId: z.string().max(100).describe("The ability ID"),
50
- name: z.string().max(LIMITS.NAME_MAX).optional().describe("New name"),
51
- description: z.string().max(LIMITS.DESCRIPTION_MAX).optional().describe("New description"),
52
- category: z.string().max(100).nullable().optional().describe("New category"),
53
- cost: z.record(z.number()).optional().describe("New cost"),
54
- cooldown: z.number().nullable().optional().describe("New cooldown"),
55
- effects: z.array(z.string().max(LIMITS.DESCRIPTION_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("New effects"),
56
- requirements: z.record(z.number()).optional().describe("New requirements"),
57
- tags: z.array(z.string().max(LIMITS.NAME_MAX)).max(LIMITS.ARRAY_MAX).optional().describe("New tags"),
58
- },
59
- annotations: ANNOTATIONS.UPDATE,
60
- }, async ({ abilityId, ...updates }) => {
61
- const ability = abilityTools.updateAbility(abilityId, updates);
62
- if (!ability) {
63
- return {
64
- content: [{ type: "text", text: "Ability not found" }],
65
- isError: true,
66
- };
67
- }
68
- return {
69
- content: [{ type: "text", text: JSON.stringify(ability, null, 2) }],
70
- };
71
- });
72
- server.registerTool("delete_ability", {
73
- description: "Delete an ability",
74
- inputSchema: {
75
- abilityId: z.string().max(100).describe("The ability ID"),
76
- },
77
- annotations: ANNOTATIONS.DESTRUCTIVE,
78
- }, async ({ abilityId }) => {
79
- const success = abilityTools.deleteAbility(abilityId);
80
- return {
81
- content: [{ type: "text", text: success ? "Ability deleted" : "Ability not found" }],
82
- isError: !success,
83
- };
84
- });
85
- server.registerTool("list_abilities", {
86
- description: "List abilities with optional filters",
87
- inputSchema: {
88
- gameId: z.string().max(100).describe("The game ID"),
89
- ownerType: z.enum(["template", "character"]).optional().describe("Filter by owner type"),
90
- ownerId: z.string().max(100).optional().describe("Filter by owner ID"),
91
- category: z.string().max(100).optional().describe("Filter by category"),
92
- },
93
- annotations: ANNOTATIONS.READ_ONLY,
94
- }, async ({ gameId, ...filter }) => {
95
- const abilities = abilityTools.listAbilities(gameId, filter);
96
- return {
97
- content: [{ type: "text", text: JSON.stringify(abilities, null, 2) }],
98
- };
99
- });
100
- server.registerTool("learn_ability", {
101
- description: "Copy a template ability to a character",
102
- inputSchema: {
103
- templateId: z.string().max(100).describe("The template ability ID"),
104
- characterId: z.string().max(100).describe("The character ID to learn the ability"),
105
- },
106
- annotations: ANNOTATIONS.CREATE,
107
- }, async ({ templateId, characterId }) => {
108
- const ability = abilityTools.learnAbility(templateId, characterId);
109
- if (!ability) {
110
- return {
111
- content: [{ type: "text", text: "Template not found or is not a template" }],
112
- isError: true,
113
- };
114
- }
115
- return {
116
- content: [{ type: "text", text: JSON.stringify(ability, null, 2) }],
117
- };
118
- });
119
- server.registerTool("use_ability", {
120
- description: "Use an ability (checks cooldown, sets new cooldown)",
121
- inputSchema: {
122
- abilityId: z.string().max(100).describe("The ability ID"),
123
- characterId: z.string().max(100).describe("The character using the ability"),
124
- },
125
- annotations: ANNOTATIONS.UPDATE,
126
- }, async ({ abilityId, characterId }) => {
127
- const result = abilityTools.useAbility(abilityId, characterId);
128
- return {
129
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
130
- isError: !result.success,
131
- };
132
- });
133
- server.registerTool("tick_ability_cooldowns", {
134
- description: "Reduce all ability cooldowns (call at end of round)",
135
- inputSchema: {
136
- gameId: z.string().max(100).describe("The game ID"),
137
- amount: z.number().optional().describe("Rounds to tick (default: 1)"),
138
- },
139
- annotations: ANNOTATIONS.UPDATE,
140
- }, async ({ gameId, amount }) => {
141
- const updated = abilityTools.tickCooldowns(gameId, amount);
142
- return {
143
- content: [{ type: "text", text: JSON.stringify({ updatedCount: updated.length, abilities: updated }, null, 2) }],
144
- };
145
- });
146
- server.registerTool("check_ability_requirements", {
147
- description: "Check if a character meets an ability's requirements",
148
- inputSchema: {
149
- abilityId: z.string().max(100).describe("The ability ID"),
150
- characterId: z.string().max(100).describe("The character ID"),
151
- },
152
- annotations: ANNOTATIONS.READ_ONLY,
153
- }, async ({ abilityId, characterId }) => {
154
- const result = abilityTools.checkRequirements(abilityId, characterId);
155
- if (!result) {
156
- return {
157
- content: [{ type: "text", text: "Ability or character not found" }],
158
- isError: true,
159
- };
160
- }
161
- return {
162
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
163
- };
164
- });
165
- }
@@ -1,2 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerCombatTools(server: McpServer): void;