Repository navigation
Support cantrip selection in character management #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,7 @@ const CreateSchema = z.object({ | |
| characterType: CharacterTypeSchema.optional().default('pc'), | ||
| factionId: z.string().optional(), | ||
| behavior: z.string().optional(), | ||
| cantripsKnown: z.array(z.string()).optional().default([]), | ||
| knownSpells: z.array(z.string()).optional().default([]), | ||
| preparedSpells: z.array(z.string()).optional().default([]), | ||
| resistances: z.array(z.string()).optional().default([]), | ||
|
|
@@ -142,6 +143,7 @@ const UpdateSchema = z.object({ | |
| level: z.number().int().min(1).optional(), | ||
| characterType: CharacterTypeSchema.optional(), | ||
| stats: StatsSchema.partial().optional(), | ||
| cantripsKnown: z.array(z.string()).optional(), | ||
| knownSpells: z.array(z.string()).optional(), | ||
| preparedSpells: z.array(z.string()).optional(), | ||
| skillProficiencies: z.array(SkillProficiencySchema).optional(), | ||
|
|
@@ -325,7 +327,7 @@ export async function handleCreate(args: z.infer<typeof CreateSchema>): Promise< | |
| factionId: args.factionId, | ||
| behavior: arg 8000 s.behavior, | ||
| knownSpells: args.knownSpells || [], | ||
| cantripsKnown: [], | ||
| cantripsKnown: args.cantripsKnown || [], | ||
| // Known spells are immediately usable after creation unless the caller | ||
| // explicitly supplies a prepared list. | ||
| preparedSpells: args.preparedSpells?.length | ||
|
|
@@ -379,7 +381,9 @@ export async function handleCreate(args: z.infer<typeof CreateSchema>): Promise< | |
| character.preparedSpells = args.preparedSpells?.length | ||
| ? [...new Set(args.preparedSpells)] | ||
| : [...new Set(character.knownSpells as string[])]; | ||
| character.cantripsKnown = provisioningResult.cantripsGranted || []; | ||
| character.cantripsKnown = args.cantripsKnown?.length | ||
| ? [...new Set(args.cantripsKnown)] | ||
| : provisioningResult.cantripsGranted || []; | ||
|
Comment on lines
+384
to
+386
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a caster is created with provisioning enabled and explicit cantrips, the provisioning call receives Useful? React with 👍 / 👎. |
||
| character.spellSlots = convertSpellSlotsToObject(provisioningResult.spellSlots ?? null); | ||
| character.pactMagicSlots = provisioningResult.pactMagicSlots || undefined; | ||
|
|
||
|
|
@@ -480,6 +484,7 @@ async function handleUpdate(args: z.infer<typeof UpdateSchema>): Promise<object> | |
| if (args.alignment !== undefined) updateData.alignment = args.alignment; | ||
| if (args.origin !== undefined) updateData.origin = args.origin; | ||
| if (args.stats !== undefined) updateData.stats = args.stats; | ||
| if (args.cantripsKnown !== undefined) updateData.cantripsKnown = args.cantripsKnown; | ||
| if (args.knownSpells !== undefined) updateData.knownSpells = args.knownSpells; | ||
| if (args.preparedSpells !== undefined) updateData.preparedSpells = args.preparedSpells; | ||
| if (args.skillProficiencies !== undefined) updateData.skillProficiencies = args.skillProficiencies; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
character_manageis invoked through the MCP server,withSessionfirst parses arguments withCharacterManageTool.inputSchema, which does not declarecantripsKnown; Zod therefore strips the field before the router reaches this action-specific schema. Consequently, both create and update selections are silently ignored in production even though the direct-handler test passes. AddcantripsKnownto the shared registered input schema as well.Useful? React with 👍 / 👎.