Description
Is your feature request related to a problem? Please describe.
When working with, e.g., dynamic prompts and using various input arguments for larger prompts, being tied to a flat structure of parameters (effectively Record<string, string>
) leads to parameters to be harder to organize than necessary.
Describe the solution you'd like
Relax the constraint of the params
type to follow the JSON RPC 2.0, where the params
field can be either of type Array
or an Object
(of arbitrary depth).
Describe alternatives you've considered
Flat structure with prefixes on keys, e.g., user information being prefixed with user
and joining array
types with array.join(", ")
. This works for now, but organizing params with an actual Object structure would make it easier to work with and maintain when dealing with more complex data.
Additional context
We're working on prompts that mix in various aspects, such as personalization based on user preferences, and we defined a structure matching the one below. However, when passing this into the McpServer.prompt
method, the types don't align due to using non-string primitives (e.g., number
) and arrays.
export const SystemPromptSchema = z
.object({
category: z.string(),
subcategory: z.string(),
world: z.object({
name: z.string(),
tagline: z.string(),
description: z.string(),
primaryColor: z.string(),
secondaryColor: z.string(),
objects: z.string().array(),
}),
tone: z.object({
emotion: z.string(),
positives: z.string().array(),
negatives: z.string().array(),
}),
vocabulary: z.string().array(),
user: z.object({
age: z.number(),
difficulty: z.number(),
interest: z.string(),
}),
})