@mythxengine/mcp-server 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 +21 -0
- package/dist/__tests__/assemble.test.d.ts +2 -0
- package/dist/__tests__/assemble.test.d.ts.map +1 -0
- package/dist/__tests__/assemble.test.js +81 -0
- package/dist/__tests__/assemble.test.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/index.d.ts +9 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +202 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +41 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +91 -0
- package/dist/server.js.map +1 -0
- package/dist/state/manager.d.ts +88 -0
- package/dist/state/manager.d.ts.map +1 -0
- package/dist/state/manager.js +308 -0
- package/dist/state/manager.js.map +1 -0
- package/dist/state/rules.d.ts +30 -0
- package/dist/state/rules.d.ts.map +1 -0
- package/dist/state/rules.js +61 -0
- package/dist/state/rules.js.map +1 -0
- package/dist/state/worldpacks.d.ts +43 -0
- package/dist/state/worldpacks.d.ts.map +1 -0
- package/dist/state/worldpacks.js +125 -0
- package/dist/state/worldpacks.js.map +1 -0
- package/dist/tools/augmentation/augment.d.ts +15 -0
- package/dist/tools/augmentation/augment.d.ts.map +1 -0
- package/dist/tools/augmentation/augment.js +512 -0
- package/dist/tools/augmentation/augment.js.map +1 -0
- package/dist/tools/augmentation/index.d.ts +6 -0
- package/dist/tools/augmentation/index.d.ts.map +1 -0
- package/dist/tools/augmentation/index.js +7 -0
- package/dist/tools/augmentation/index.js.map +1 -0
- package/dist/tools/characters.d.ts +26 -0
- package/dist/tools/characters.d.ts.map +1 -0
- package/dist/tools/characters.js +362 -0
- package/dist/tools/characters.js.map +1 -0
- package/dist/tools/clocks.d.ts +33 -0
- package/dist/tools/clocks.d.ts.map +1 -0
- package/dist/tools/clocks.js +438 -0
- package/dist/tools/clocks.js.map +1 -0
- package/dist/tools/combat.d.ts +38 -0
- package/dist/tools/combat.d.ts.map +1 -0
- package/dist/tools/combat.js +574 -0
- package/dist/tools/combat.js.map +1 -0
- package/dist/tools/dice.d.ts +9 -0
- package/dist/tools/dice.d.ts.map +1 -0
- package/dist/tools/dice.js +287 -0
- package/dist/tools/dice.js.map +1 -0
- package/dist/tools/encounters.d.ts +21 -0
- package/dist/tools/encounters.d.ts.map +1 -0
- package/dist/tools/encounters.js +521 -0
- package/dist/tools/encounters.js.map +1 -0
- package/dist/tools/engagement.d.ts +25 -0
- package/dist/tools/engagement.d.ts.map +1 -0
- package/dist/tools/engagement.js +491 -0
- package/dist/tools/engagement.js.map +1 -0
- package/dist/tools/expansion/archetype.d.ts +12 -0
- package/dist/tools/expansion/archetype.d.ts.map +1 -0
- package/dist/tools/expansion/archetype.js +157 -0
- package/dist/tools/expansion/archetype.js.map +1 -0
- package/dist/tools/expansion/index.d.ts +12 -0
- package/dist/tools/expansion/index.d.ts.map +1 -0
- package/dist/tools/expansion/index.js +21 -0
- package/dist/tools/expansion/index.js.map +1 -0
- package/dist/tools/expansion/location.d.ts +12 -0
- package/dist/tools/expansion/location.d.ts.map +1 -0
- package/dist/tools/expansion/location.js +149 -0
- package/dist/tools/expansion/location.js.map +1 -0
- package/dist/tools/expansion/monster.d.ts +12 -0
- package/dist/tools/expansion/monster.d.ts.map +1 -0
- package/dist/tools/expansion/monster.js +157 -0
- package/dist/tools/expansion/monster.js.map +1 -0
- package/dist/tools/expansion/npc.d.ts +12 -0
- package/dist/tools/expansion/npc.d.ts.map +1 -0
- package/dist/tools/expansion/npc.js +153 -0
- package/dist/tools/expansion/npc.js.map +1 -0
- package/dist/tools/generation/archetypes.d.ts +12 -0
- package/dist/tools/generation/archetypes.d.ts.map +1 -0
- package/dist/tools/generation/archetypes.js +129 -0
- package/dist/tools/generation/archetypes.js.map +1 -0
- package/dist/tools/generation/arcs.d.ts +13 -0
- package/dist/tools/generation/arcs.d.ts.map +1 -0
- package/dist/tools/generation/arcs.js +186 -0
- package/dist/tools/generation/arcs.js.map +1 -0
- package/dist/tools/generation/encounters.d.ts +12 -0
- package/dist/tools/generation/encounters.d.ts.map +1 -0
- package/dist/tools/generation/encounters.js +169 -0
- package/dist/tools/generation/encounters.js.map +1 -0
- package/dist/tools/generation/index.d.ts +19 -0
- package/dist/tools/generation/index.d.ts.map +1 -0
- package/dist/tools/generation/index.js +42 -0
- package/dist/tools/generation/index.js.map +1 -0
- package/dist/tools/generation/items.d.ts +12 -0
- package/dist/tools/generation/items.d.ts.map +1 -0
- package/dist/tools/generation/items.js +149 -0
- package/dist/tools/generation/items.js.map +1 -0
- package/dist/tools/generation/locations.d.ts +12 -0
- package/dist/tools/generation/locations.d.ts.map +1 -0
- package/dist/tools/generation/locations.js +131 -0
- package/dist/tools/generation/locations.js.map +1 -0
- package/dist/tools/generation/monsters.d.ts +12 -0
- package/dist/tools/generation/monsters.d.ts.map +1 -0
- package/dist/tools/generation/monsters.js +154 -0
- package/dist/tools/generation/monsters.js.map +1 -0
- package/dist/tools/generation/narrative.d.ts +12 -0
- package/dist/tools/generation/narrative.d.ts.map +1 -0
- package/dist/tools/generation/narrative.js +129 -0
- package/dist/tools/generation/narrative.js.map +1 -0
- package/dist/tools/generation/npcs.d.ts +12 -0
- package/dist/tools/generation/npcs.d.ts.map +1 -0
- package/dist/tools/generation/npcs.js +136 -0
- package/dist/tools/generation/npcs.js.map +1 -0
- package/dist/tools/generation/resume.d.ts +12 -0
- package/dist/tools/generation/resume.d.ts.map +1 -0
- package/dist/tools/generation/resume.js +288 -0
- package/dist/tools/generation/resume.js.map +1 -0
- package/dist/tools/generation/rules-prompt.d.ts +23 -0
- package/dist/tools/generation/rules-prompt.d.ts.map +1 -0
- package/dist/tools/generation/rules-prompt.js +209 -0
- package/dist/tools/generation/rules-prompt.js.map +1 -0
- package/dist/tools/generation/seed.d.ts +12 -0
- package/dist/tools/generation/seed.d.ts.map +1 -0
- package/dist/tools/generation/seed.js +171 -0
- package/dist/tools/generation/seed.js.map +1 -0
- package/dist/tools/generation/situations.d.ts +13 -0
- package/dist/tools/generation/situations.d.ts.map +1 -0
- package/dist/tools/generation/situations.js +247 -0
- package/dist/tools/generation/situations.js.map +1 -0
- package/dist/tools/gm-guidance.d.ts +13 -0
- package/dist/tools/gm-guidance.d.ts.map +1 -0
- package/dist/tools/gm-guidance.js +395 -0
- package/dist/tools/gm-guidance.js.map +1 -0
- package/dist/tools/index.d.ts +33 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +80 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/investigation.d.ts +41 -0
- package/dist/tools/investigation.d.ts.map +1 -0
- package/dist/tools/investigation.js +586 -0
- package/dist/tools/investigation.js.map +1 -0
- package/dist/tools/leads.d.ts +29 -0
- package/dist/tools/leads.d.ts.map +1 -0
- package/dist/tools/leads.js +460 -0
- package/dist/tools/leads.js.map +1 -0
- package/dist/tools/players.d.ts +30 -0
- package/dist/tools/players.d.ts.map +1 -0
- package/dist/tools/players.js +448 -0
- package/dist/tools/players.js.map +1 -0
- package/dist/tools/portable-clues.d.ts +29 -0
- package/dist/tools/portable-clues.d.ts.map +1 -0
- package/dist/tools/portable-clues.js +490 -0
- package/dist/tools/portable-clues.js.map +1 -0
- package/dist/tools/relationships.d.ts +29 -0
- package/dist/tools/relationships.d.ts.map +1 -0
- package/dist/tools/relationships.js +471 -0
- package/dist/tools/relationships.js.map +1 -0
- package/dist/tools/scene-framing.d.ts +21 -0
- package/dist/tools/scene-framing.d.ts.map +1 -0
- package/dist/tools/scene-framing.js +380 -0
- package/dist/tools/scene-framing.js.map +1 -0
- package/dist/tools/sessions.d.ts +30 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +253 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/time.d.ts +26 -0
- package/dist/tools/time.d.ts.map +1 -0
- package/dist/tools/time.js +438 -0
- package/dist/tools/time.js.map +1 -0
- package/dist/tools/turns.d.ts +38 -0
- package/dist/tools/turns.d.ts.map +1 -0
- package/dist/tools/turns.js +560 -0
- package/dist/tools/turns.js.map +1 -0
- package/dist/tools/worldpack/assemble.d.ts +20 -0
- package/dist/tools/worldpack/assemble.d.ts.map +1 -0
- package/dist/tools/worldpack/assemble.js +237 -0
- package/dist/tools/worldpack/assemble.js.map +1 -0
- package/dist/tools/worldpack/docs-generator.d.ts +18 -0
- package/dist/tools/worldpack/docs-generator.d.ts.map +1 -0
- package/dist/tools/worldpack/docs-generator.js +264 -0
- package/dist/tools/worldpack/docs-generator.js.map +1 -0
- package/dist/tools/worldpack/export.d.ts +12 -0
- package/dist/tools/worldpack/export.d.ts.map +1 -0
- package/dist/tools/worldpack/export.js +209 -0
- package/dist/tools/worldpack/export.js.map +1 -0
- package/dist/tools/worldpack/index.d.ts +15 -0
- package/dist/tools/worldpack/index.d.ts.map +1 -0
- package/dist/tools/worldpack/index.js +30 -0
- package/dist/tools/worldpack/index.js.map +1 -0
- package/dist/tools/worldpack/lookup.d.ts +19 -0
- package/dist/tools/worldpack/lookup.d.ts.map +1 -0
- package/dist/tools/worldpack/lookup.js +320 -0
- package/dist/tools/worldpack/lookup.js.map +1 -0
- package/dist/tools/worldpack/manage.d.ts +20 -0
- package/dist/tools/worldpack/manage.d.ts.map +1 -0
- package/dist/tools/worldpack/manage.js +101 -0
- package/dist/tools/worldpack/manage.js.map +1 -0
- package/dist/tools/worldpack/save-result.d.ts +12 -0
- package/dist/tools/worldpack/save-result.d.ts.map +1 -0
- package/dist/tools/worldpack/save-result.js +222 -0
- package/dist/tools/worldpack/save-result.js.map +1 -0
- package/dist/tools/worldpack/summary.d.ts +13 -0
- package/dist/tools/worldpack/summary.d.ts.map +1 -0
- package/dist/tools/worldpack/summary.js +180 -0
- package/dist/tools/worldpack/summary.js.map +1 -0
- package/dist/tools/worldpack/validate.d.ts +12 -0
- package/dist/tools/worldpack/validate.d.ts.map +1 -0
- package/dist/tools/worldpack/validate.js +388 -0
- package/dist/tools/worldpack/validate.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archetype Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands an archetype with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
8
|
+
import { sessionManager, readManifest, writeManifest, addManifestStep, } from "../../state/manager.js";
|
|
9
|
+
const ExpandArchetypeInput = z.object({
|
|
10
|
+
sessionId: z.string(),
|
|
11
|
+
archetypeId: z.string().describe("ID of the archetype to expand"),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* expand_archetype tool
|
|
15
|
+
*/
|
|
16
|
+
export const expandArchetypeTool = {
|
|
17
|
+
name: "expand_archetype",
|
|
18
|
+
description: "Expand an archetype with additional detail (skill progression, party role, RP hooks). Returns a prompt for LLM execution.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
sessionId: { type: "string", description: "Session ID" },
|
|
23
|
+
archetypeId: { type: "string", description: "ID of the archetype to expand" },
|
|
24
|
+
},
|
|
25
|
+
required: ["sessionId", "archetypeId"],
|
|
26
|
+
},
|
|
27
|
+
handler: async (args) => {
|
|
28
|
+
const input = ExpandArchetypeInput.parse(args);
|
|
29
|
+
const session = await sessionManager.get(input.sessionId);
|
|
30
|
+
if (!session) {
|
|
31
|
+
throw new Error(`Session not found: ${input.sessionId}`);
|
|
32
|
+
}
|
|
33
|
+
if (!session.generation?.worldSeed) {
|
|
34
|
+
throw new Error("World seed not found. Call generate_world_seed first.");
|
|
35
|
+
}
|
|
36
|
+
const worldSeed = session.generation.worldSeed;
|
|
37
|
+
// Find the archetype
|
|
38
|
+
const archetypes = session.generation.generatedContent.archetypes;
|
|
39
|
+
const archetype = archetypes.find((a) => a.id === input.archetypeId);
|
|
40
|
+
if (!archetype) {
|
|
41
|
+
throw new Error(`Archetype not found: ${input.archetypeId}`);
|
|
42
|
+
}
|
|
43
|
+
// Check if already expanded
|
|
44
|
+
const expandedArchetypes = session.generation.expansions.archetypes;
|
|
45
|
+
const alreadyExpanded = expandedArchetypes.find((a) => a.id === input.archetypeId);
|
|
46
|
+
if (alreadyExpanded) {
|
|
47
|
+
throw new Error(`Archetype already expanded: ${input.archetypeId}`);
|
|
48
|
+
}
|
|
49
|
+
const stepId = randomUUID();
|
|
50
|
+
// Get other archetypes for party role context
|
|
51
|
+
const otherArchetypes = session.generation.generatedContent.archetypes
|
|
52
|
+
.filter(a => a.id !== input.archetypeId);
|
|
53
|
+
// Record the generation step
|
|
54
|
+
session.generation.history.push({
|
|
55
|
+
id: stepId,
|
|
56
|
+
type: "expand_archetype",
|
|
57
|
+
startedAt: new Date().toISOString(),
|
|
58
|
+
completedAt: null,
|
|
59
|
+
status: "in_progress",
|
|
60
|
+
generatedIds: [],
|
|
61
|
+
});
|
|
62
|
+
session.generation.status = "expanding";
|
|
63
|
+
await sessionManager.save(session);
|
|
64
|
+
// Update manifest
|
|
65
|
+
const manifest = await readManifest(input.sessionId);
|
|
66
|
+
if (manifest) {
|
|
67
|
+
addManifestStep(manifest, "expand_archetype", `expansions/archetype-${input.archetypeId}.json`);
|
|
68
|
+
manifest.status = "expanding";
|
|
69
|
+
await writeManifest(input.sessionId, manifest);
|
|
70
|
+
}
|
|
71
|
+
const systemPrompt = `You are expanding a character archetype for a tabletop RPG. Add skill progression, party role guidance, and roleplay hooks while maintaining the archetype's established identity.
|
|
72
|
+
|
|
73
|
+
Rules:
|
|
74
|
+
- Skill progression should show natural character growth
|
|
75
|
+
- Party role explains how this archetype works with others
|
|
76
|
+
- Roleplay hooks give players story threads to explore
|
|
77
|
+
- Suggested traits help players quickly get into character
|
|
78
|
+
|
|
79
|
+
Output valid JSON only.`;
|
|
80
|
+
const userPrompt = `Expand this archetype with additional detail:
|
|
81
|
+
|
|
82
|
+
World: ${worldSeed.name}
|
|
83
|
+
Tone: ${worldSeed.aesthetic.tone}
|
|
84
|
+
Themes: ${worldSeed.aesthetic.themes.join(", ")}
|
|
85
|
+
Core Conflict: ${worldSeed.coreConflict}
|
|
86
|
+
|
|
87
|
+
Archetype to expand:
|
|
88
|
+
- ID: ${archetype.id}
|
|
89
|
+
- Name: ${archetype.name}
|
|
90
|
+
- Tagline: ${archetype.tagline}
|
|
91
|
+
- Description: ${archetype.description}
|
|
92
|
+
- Starting Abilities: ${JSON.stringify(archetype.starting.abilities)}
|
|
93
|
+
- HP: ${archetype.starting.hp}
|
|
94
|
+
- Features: ${archetype.features.map(f => f.name).join(", ")}
|
|
95
|
+
- Playstyle: ${archetype.playstyle}
|
|
96
|
+
- Background: ${archetype.background}
|
|
97
|
+
|
|
98
|
+
Other archetypes in the world (for party role context):
|
|
99
|
+
${otherArchetypes.map(a => `- ${a.name}: ${a.tagline}`).join("\n")}
|
|
100
|
+
|
|
101
|
+
Output a JSON object with the expanded archetype (include ALL original fields plus new ones):
|
|
102
|
+
{
|
|
103
|
+
"expandedArchetype": {
|
|
104
|
+
"id": "${archetype.id}",
|
|
105
|
+
"name": "${archetype.name}",
|
|
106
|
+
"tagline": "${archetype.tagline}",
|
|
107
|
+
"description": "${archetype.description}",
|
|
108
|
+
"starting": ${JSON.stringify(archetype.starting)},
|
|
109
|
+
"startingItems": ${JSON.stringify(archetype.startingItems)},
|
|
110
|
+
"features": ${JSON.stringify(archetype.features)},
|
|
111
|
+
"playstyle": "${archetype.playstyle}",
|
|
112
|
+
"background": "${archetype.background}",
|
|
113
|
+
"flavor": "${archetype.flavor}",
|
|
114
|
+
"skillProgression": [
|
|
115
|
+
{
|
|
116
|
+
"level": 1,
|
|
117
|
+
"skills": ["Starting skill focus areas"]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"level": 3,
|
|
121
|
+
"skills": ["Mid-game skill development"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"level": 5,
|
|
125
|
+
"skills": ["Advanced skill mastery"]
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"partyRole": "How this archetype contributes to a party and synergizes with others",
|
|
129
|
+
"roleplayHooks": [
|
|
130
|
+
"A personal quest or goal",
|
|
131
|
+
"A relationship or bond to explore",
|
|
132
|
+
"A flaw that creates drama",
|
|
133
|
+
"A secret or mystery"
|
|
134
|
+
],
|
|
135
|
+
"suggestedTraits": [
|
|
136
|
+
"A personality trait that fits",
|
|
137
|
+
"A quirk or habit",
|
|
138
|
+
"A value or belief",
|
|
139
|
+
"A fear or weakness"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Return ONLY the JSON object, no markdown formatting.`;
|
|
145
|
+
return {
|
|
146
|
+
prompt: {
|
|
147
|
+
system: systemPrompt,
|
|
148
|
+
user: userPrompt,
|
|
149
|
+
outputSchemaName: "ExpandedArchetype",
|
|
150
|
+
},
|
|
151
|
+
stepId,
|
|
152
|
+
message: `Archetype expansion initiated for ${archetype.name}. Execute the prompt and call save_generation_result.`,
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
export const expandArchetypeTools = [expandArchetypeTool];
|
|
157
|
+
//# sourceMappingURL=archetype.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archetype.js","sourceRoot":"","sources":["../../../src/tools/expansion/archetype.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IAC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;;;;;;;;;;;;;;;;;;;;;;;;qDA+BoB,CAAC;QAElD,OAAO;YACL,MAAM,EAAE;gBACN,MAAM,EAAE,YAAY;gBACpB,IAAI,EAAE,UAAU;gBAChB,gBAAgB,EAAE,mBAAmB;aACtC;YACD,MAAM;YACN,OAAO,EAAE,qCAAqC,SAAS,CAAC,IAAI,uDAAuD;SACpH,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expansion tools - content detail expansion
|
|
3
|
+
*/
|
|
4
|
+
export { expandLocationTools, expandLocationTool } from "./location.js";
|
|
5
|
+
export { expandArchetypeTools, expandArchetypeTool } from "./archetype.js";
|
|
6
|
+
export { expandNPCTools, expandNPCTool } from "./npc.js";
|
|
7
|
+
export { expandMonsterTools, expandMonsterTool } from "./monster.js";
|
|
8
|
+
/**
|
|
9
|
+
* All expansion tools
|
|
10
|
+
*/
|
|
11
|
+
export declare const expansionTools: import("@mythxengine/types").MCPToolEntry[];
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/expansion/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOrE;;GAEG;AACH,eAAO,MAAM,cAAc,6CAK1B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expansion tools - content detail expansion
|
|
3
|
+
*/
|
|
4
|
+
export { expandLocationTools, expandLocationTool } from "./location.js";
|
|
5
|
+
export { expandArchetypeTools, expandArchetypeTool } from "./archetype.js";
|
|
6
|
+
export { expandNPCTools, expandNPCTool } from "./npc.js";
|
|
7
|
+
export { expandMonsterTools, expandMonsterTool } from "./monster.js";
|
|
8
|
+
import { expandLocationTools } from "./location.js";
|
|
9
|
+
import { expandArchetypeTools } from "./archetype.js";
|
|
10
|
+
import { expandNPCTools } from "./npc.js";
|
|
11
|
+
import { expandMonsterTools } from "./monster.js";
|
|
12
|
+
/**
|
|
13
|
+
* All expansion tools
|
|
14
|
+
*/
|
|
15
|
+
export const expansionTools = [
|
|
16
|
+
...expandLocationTools,
|
|
17
|
+
...expandArchetypeTools,
|
|
18
|
+
...expandNPCTools,
|
|
19
|
+
...expandMonsterTools,
|
|
20
|
+
];
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/expansion/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,mBAAmB;IACtB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,kBAAkB;CACtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands a location with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPToolEntry } from "@mythxengine/types";
|
|
7
|
+
/**
|
|
8
|
+
* expand_location tool
|
|
9
|
+
*/
|
|
10
|
+
export declare const expandLocationTool: MCPToolEntry;
|
|
11
|
+
export declare const expandLocationTools: MCPToolEntry[];
|
|
12
|
+
//# sourceMappingURL=location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../src/tools/expansion/location.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAavD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,YAmKhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands a location with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
8
|
+
import { sessionManager, readManifest, writeManifest, addManifestStep, } from "../../state/manager.js";
|
|
9
|
+
const ExpandLocationInput = z.object({
|
|
10
|
+
sessionId: z.string(),
|
|
11
|
+
locationId: z.string().describe("ID of the location to expand"),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* expand_location tool
|
|
15
|
+
*/
|
|
16
|
+
export const expandLocationTool = {
|
|
17
|
+
name: "expand_location",
|
|
18
|
+
description: "Expand a location with additional detail (areas, random encounters, treasure). Returns a prompt for LLM execution.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
sessionId: { type: "string", description: "Session ID" },
|
|
23
|
+
locationId: { type: "string", description: "ID of the location to expand" },
|
|
24
|
+
},
|
|
25
|
+
required: ["sessionId", "locationId"],
|
|
26
|
+
},
|
|
27
|
+
handler: async (args) => {
|
|
28
|
+
const input = ExpandLocationInput.parse(args);
|
|
29
|
+
const session = await sessionManager.get(input.sessionId);
|
|
30
|
+
if (!session) {
|
|
31
|
+
throw new Error(`Session not found: ${input.sessionId}`);
|
|
32
|
+
}
|
|
33
|
+
if (!session.generation?.worldSeed) {
|
|
34
|
+
throw new Error("World seed not found. Call generate_world_seed first.");
|
|
35
|
+
}
|
|
36
|
+
const worldSeed = session.generation.worldSeed;
|
|
37
|
+
// Find the location
|
|
38
|
+
const locations = session.generation.generatedContent.locations;
|
|
39
|
+
const location = locations.find((l) => l.id === input.locationId);
|
|
40
|
+
if (!location) {
|
|
41
|
+
throw new Error(`Location not found: ${input.locationId}`);
|
|
42
|
+
}
|
|
43
|
+
// Check if already expanded
|
|
44
|
+
const expandedLocations = session.generation.expansions.locations;
|
|
45
|
+
const alreadyExpanded = expandedLocations.find((l) => l.id === input.locationId);
|
|
46
|
+
if (alreadyExpanded) {
|
|
47
|
+
throw new Error(`Location already expanded: ${input.locationId}`);
|
|
48
|
+
}
|
|
49
|
+
const stepId = randomUUID();
|
|
50
|
+
// Get available encounters for random encounter table
|
|
51
|
+
const encounters = session.generation.generatedContent.encounters;
|
|
52
|
+
// Record the generation step
|
|
53
|
+
session.generation.history.push({
|
|
54
|
+
id: stepId,
|
|
55
|
+
type: "expand_location",
|
|
56
|
+
startedAt: new Date().toISOString(),
|
|
57
|
+
completedAt: null,
|
|
58
|
+
status: "in_progress",
|
|
59
|
+
generatedIds: [],
|
|
60
|
+
});
|
|
61
|
+
session.generation.status = "expanding";
|
|
62
|
+
await sessionManager.save(session);
|
|
63
|
+
// Update manifest
|
|
64
|
+
const manifest = await readManifest(input.sessionId);
|
|
65
|
+
if (manifest) {
|
|
66
|
+
addManifestStep(manifest, "expand_location", `expansions/location-${input.locationId}.json`);
|
|
67
|
+
manifest.status = "expanding";
|
|
68
|
+
await writeManifest(input.sessionId, manifest);
|
|
69
|
+
}
|
|
70
|
+
const systemPrompt = `You are expanding a location for a tabletop RPG. Add detailed areas, random encounters, and treasure while maintaining consistency with the existing description.
|
|
71
|
+
|
|
72
|
+
Rules:
|
|
73
|
+
- Areas should be distinct sub-locations within the main location
|
|
74
|
+
- Random encounters use weights (higher = more likely) totaling roughly 100
|
|
75
|
+
- Treasure should fit the location type and world tone
|
|
76
|
+
- Maintain the established atmosphere and features
|
|
77
|
+
|
|
78
|
+
Output valid JSON only.`;
|
|
79
|
+
const userPrompt = `Expand this location with additional detail:
|
|
80
|
+
|
|
81
|
+
World: ${worldSeed.name}
|
|
82
|
+
Visual Style: ${worldSeed.aesthetic.visualStyle}
|
|
83
|
+
Tone: ${worldSeed.aesthetic.tone}
|
|
84
|
+
Lethality: ${worldSeed.settings.lethality}
|
|
85
|
+
|
|
86
|
+
Location to expand:
|
|
87
|
+
- ID: ${location.id}
|
|
88
|
+
- Name: ${location.name}
|
|
89
|
+
- Type: ${location.type}
|
|
90
|
+
- Description: ${location.description}
|
|
91
|
+
- Atmosphere: ${location.atmosphere}
|
|
92
|
+
- Features: ${location.features.join(", ")}
|
|
93
|
+
|
|
94
|
+
Available encounters for random table:
|
|
95
|
+
${encounters.map(e => `- ${e.id}: ${e.name} (${e.type})`).join("\n")}
|
|
96
|
+
|
|
97
|
+
Output a JSON object with the expanded location (include ALL original fields plus new ones):
|
|
98
|
+
{
|
|
99
|
+
"expandedLocation": {
|
|
100
|
+
"id": "${location.id}",
|
|
101
|
+
"name": "${location.name}",
|
|
102
|
+
"description": "${location.description}",
|
|
103
|
+
"type": "${location.type}",
|
|
104
|
+
"atmosphere": "${location.atmosphere}",
|
|
105
|
+
"features": ${JSON.stringify(location.features)},
|
|
106
|
+
"connections": [],
|
|
107
|
+
"encounters": [],
|
|
108
|
+
"npcs": [],
|
|
109
|
+
"secrets": [],
|
|
110
|
+
"gmNotes": "",
|
|
111
|
+
"areas": [
|
|
112
|
+
{
|
|
113
|
+
"name": "Area Name",
|
|
114
|
+
"description": "What this sub-area looks like and contains",
|
|
115
|
+
"features": ["Notable thing 1", "Notable thing 2"]
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"randomEncounters": [
|
|
119
|
+
{
|
|
120
|
+
"weight": 30,
|
|
121
|
+
"encounterId": "encounter:id-from-list"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"treasure": [
|
|
125
|
+
"Description of findable treasure or loot"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
Notes:
|
|
131
|
+
- Add 2-4 distinct areas
|
|
132
|
+
- Include 3-5 random encounters with weights
|
|
133
|
+
- Add 2-4 treasure items appropriate to the location
|
|
134
|
+
- Keep original fields intact
|
|
135
|
+
|
|
136
|
+
Return ONLY the JSON object, no markdown formatting.`;
|
|
137
|
+
return {
|
|
138
|
+
prompt: {
|
|
139
|
+
system: systemPrompt,
|
|
140
|
+
user: userPrompt,
|
|
141
|
+
outputSchemaName: "ExpandedLocation",
|
|
142
|
+
},
|
|
143
|
+
stepId,
|
|
144
|
+
message: `Location expansion initiated for ${location.name}. Execute the prompt and call save_generation_result.`,
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
export const expandLocationTools = [expandLocationTool];
|
|
149
|
+
//# sourceMappingURL=location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../src/tools/expansion/location.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,E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,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monster Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands a monster with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPToolEntry } from "@mythxengine/types";
|
|
7
|
+
/**
|
|
8
|
+
* expand_monster tool
|
|
9
|
+
*/
|
|
10
|
+
export declare const expandMonsterTool: MCPToolEntry;
|
|
11
|
+
export declare const expandMonsterTools: MCPToolEntry[];
|
|
12
|
+
//# sourceMappingURL=monster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monster.d.ts","sourceRoot":"","sources":["../../../src/tools/expansion/monster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAavD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAmL/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,gBAAsB,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monster Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands a monster with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
8
|
+
import { sessionManager, readManifest, writeManifest, addManifestStep, } from "../../state/manager.js";
|
|
9
|
+
const ExpandMonsterInput = z.object({
|
|
10
|
+
sessionId: z.string(),
|
|
11
|
+
monsterId: z.string().describe("ID of the monster to expand"),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* expand_monster tool
|
|
15
|
+
*/
|
|
16
|
+
export const expandMonsterTool = {
|
|
17
|
+
name: "expand_monster",
|
|
18
|
+
description: "Expand a monster with additional detail (lair, variants, ecology). Returns a prompt for LLM execution.",
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
sessionId: { type: "string", description: "Session ID" },
|
|
23
|
+
monsterId: { type: "string", description: "ID of the monster to expand" },
|
|
24
|
+
},
|
|
25
|
+
required: ["sessionId", "monsterId"],
|
|
26
|
+
},
|
|
27
|
+
handler: async (args) => {
|
|
28
|
+
const input = ExpandMonsterInput.parse(args);
|
|
29
|
+
const session = await sessionManager.get(input.sessionId);
|
|
30
|
+
if (!session) {
|
|
31
|
+
throw new Error(`Session not found: ${input.sessionId}`);
|
|
32
|
+
}
|
|
33
|
+
if (!session.generation?.worldSeed) {
|
|
34
|
+
throw new Error("World seed not found. Call generate_world_seed first.");
|
|
35
|
+
}
|
|
36
|
+
const worldSeed = session.generation.worldSeed;
|
|
37
|
+
// Find the monster
|
|
38
|
+
const monsters = session.generation.generatedContent.monsters;
|
|
39
|
+
const monster = monsters.find((m) => m.id === input.monsterId);
|
|
40
|
+
if (!monster) {
|
|
41
|
+
throw new Error(`Monster not found: ${input.monsterId}`);
|
|
42
|
+
}
|
|
43
|
+
// Check if already expanded
|
|
44
|
+
const expandedMonsters = session.generation.expansions.monsters;
|
|
45
|
+
const alreadyExpanded = expandedMonsters.find((m) => m.id === input.monsterId);
|
|
46
|
+
if (alreadyExpanded) {
|
|
47
|
+
throw new Error(`Monster already expanded: ${input.monsterId}`);
|
|
48
|
+
}
|
|
49
|
+
const stepId = randomUUID();
|
|
50
|
+
// Get items for treasure
|
|
51
|
+
const items = session.generation.generatedContent.items;
|
|
52
|
+
// Record the generation step
|
|
53
|
+
session.generation.history.push({
|
|
54
|
+
id: stepId,
|
|
55
|
+
type: "expand_monster",
|
|
56
|
+
startedAt: new Date().toISOString(),
|
|
57
|
+
completedAt: null,
|
|
58
|
+
status: "in_progress",
|
|
59
|
+
generatedIds: [],
|
|
60
|
+
});
|
|
61
|
+
session.generation.status = "expanding";
|
|
62
|
+
await sessionManager.save(session);
|
|
63
|
+
// Update manifest
|
|
64
|
+
const manifest = await readManifest(input.sessionId);
|
|
65
|
+
if (manifest) {
|
|
66
|
+
addManifestStep(manifest, "expand_monster", `expansions/monster-${input.monsterId}.json`);
|
|
67
|
+
manifest.status = "expanding";
|
|
68
|
+
await writeManifest(input.sessionId, manifest);
|
|
69
|
+
}
|
|
70
|
+
const systemPrompt = `You are expanding a monster for a tabletop RPG. Add lair details, variants, and ecology while maintaining the monster's established identity.
|
|
71
|
+
|
|
72
|
+
Rules:
|
|
73
|
+
- Lair should be a dangerous, atmospheric location
|
|
74
|
+
- Variants offer different takes on the base monster
|
|
75
|
+
- Ecology explains how they fit into the world
|
|
76
|
+
- Treasure should make sense for the creature
|
|
77
|
+
|
|
78
|
+
Output valid JSON only.`;
|
|
79
|
+
const userPrompt = `Expand this monster with additional detail:
|
|
80
|
+
|
|
81
|
+
World: ${worldSeed.name}
|
|
82
|
+
Visual Style: ${worldSeed.aesthetic.visualStyle}
|
|
83
|
+
Tone: ${worldSeed.aesthetic.tone}
|
|
84
|
+
Lethality: ${worldSeed.settings.lethality}
|
|
85
|
+
Supernatural Presence: ${worldSeed.settings.supernaturalPresence}
|
|
86
|
+
|
|
87
|
+
Monster to expand:
|
|
88
|
+
- ID: ${monster.id}
|
|
89
|
+
- Name: ${monster.name}
|
|
90
|
+
- Description: ${monster.description}
|
|
91
|
+
- Threat: ${monster.threat}
|
|
92
|
+
- HP: ${monster.hp}, Armor: ${monster.armor}
|
|
93
|
+
- Abilities: ${JSON.stringify(monster.abilities)}
|
|
94
|
+
- Attacks: ${monster.attacks.map(a => a.name).join(", ")}
|
|
95
|
+
- Special Abilities: ${monster.specialAbilities.join("; ")}
|
|
96
|
+
- Lore: ${monster.lore}
|
|
97
|
+
- Tactics: ${monster.tactics.specialBehavior || `${monster.tactics.preferredRange}, targets ${monster.tactics.targetPriority}`}
|
|
98
|
+
|
|
99
|
+
Available items for treasure:
|
|
100
|
+
${items.slice(0, 15).map(i => `- ${i.id}: ${i.name} (${i.kind})`).join("\n")}
|
|
101
|
+
|
|
102
|
+
Output a JSON object with the expanded monster (include ALL original fields plus new ones):
|
|
103
|
+
{
|
|
104
|
+
"expandedMonster": {
|
|
105
|
+
"id": "${monster.id}",
|
|
106
|
+
"name": "${monster.name}",
|
|
107
|
+
"description": "${monster.description}",
|
|
108
|
+
"hp": ${monster.hp},
|
|
109
|
+
"armor": ${monster.armor},
|
|
110
|
+
"abilities": ${JSON.stringify(monster.abilities)},
|
|
111
|
+
"threat": "${monster.threat}",
|
|
112
|
+
"attacks": ${JSON.stringify(monster.attacks)},
|
|
113
|
+
"specialAbilities": ${JSON.stringify(monster.specialAbilities)},
|
|
114
|
+
"morale": ${JSON.stringify(monster.morale)},
|
|
115
|
+
"tactics": ${JSON.stringify(monster.tactics)},
|
|
116
|
+
"lore": "${monster.lore}",
|
|
117
|
+
"encounterText": "${monster.encounterText}",
|
|
118
|
+
"deathText": "${monster.deathText}",
|
|
119
|
+
"lair": {
|
|
120
|
+
"description": "Description of where this creature makes its home",
|
|
121
|
+
"hazards": ["Environmental hazard 1", "Environmental hazard 2"],
|
|
122
|
+
"treasure": ["item:id-from-list", "Description of unique loot"]
|
|
123
|
+
},
|
|
124
|
+
"variants": [
|
|
125
|
+
{
|
|
126
|
+
"name": "Variant Name",
|
|
127
|
+
"description": "How this variant differs",
|
|
128
|
+
"modifications": {
|
|
129
|
+
"hp": "+4",
|
|
130
|
+
"newAbility": "Description of added capability"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"ecology": "How this creature fits into the world - diet, reproduction, territory, etc."
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Notes:
|
|
139
|
+
- Lair should include 2-3 hazards
|
|
140
|
+
- Treasure should include 2-4 items
|
|
141
|
+
- Include 1-2 variants
|
|
142
|
+
- Ecology should be 2-3 sentences
|
|
143
|
+
|
|
144
|
+
Return ONLY the JSON object, no markdown formatting.`;
|
|
145
|
+
return {
|
|
146
|
+
prompt: {
|
|
147
|
+
system: systemPrompt,
|
|
148
|
+
user: userPrompt,
|
|
149
|
+
outputSchemaName: "ExpandedMonster",
|
|
150
|
+
},
|
|
151
|
+
stepId,
|
|
152
|
+
message: `Monster expansion initiated for ${monster.name}. Execute the prompt and call save_generation_result.`,
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
export const expandMonsterTools = [expandMonsterTool];
|
|
157
|
+
//# sourceMappingURL=monster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monster.js","sourceRoot":"","sources":["../../../src/tools/expansion/monster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC9D,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAiB;IAC7C,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,wGAAwG;IACrH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE;YACxD,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;SAC1E;QACD,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;KACrC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7C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,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPC Expansion Tool
|
|
3
|
+
*
|
|
4
|
+
* Expands an NPC with additional detail.
|
|
5
|
+
*/
|
|
6
|
+
import type { MCPToolEntry } from "@mythxengine/types";
|
|
7
|
+
/**
|
|
8
|
+
* expand_npc tool
|
|
9
|
+
*/
|
|
10
|
+
export declare const expandNPCTool: MCPToolEntry;
|
|
11
|
+
export declare const expandNPCTools: MCPToolEntry[];
|
|
12
|
+
//# sourceMappingURL=npc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npc.d.ts","sourceRoot":"","sources":["../../../src/tools/expansion/npc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAavD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YA6K3B,CAAC;AAEF,eAAO,MAAM,cAAc,gBAAkB,CAAC"}
|