Skip to content

Adds _meta to additional interface types #630

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

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const RequestSchema = z.object({
const BaseNotificationParamsSchema = z
.object({
/**
* This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
*/
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();
Expand All @@ -58,8 +58,8 @@ export const NotificationSchema = z.object({
export const ResultSchema = z
.object({
/**
* This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
*/
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();
Expand Down Expand Up @@ -463,6 +463,11 @@ export const ResourceSchema = z
* The MIME type of this resource, if known.
*/
mimeType: z.optional(z.string()),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand Down Expand Up @@ -494,6 +499,11 @@ export const ResourceTemplateSchema = z
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
*/
mimeType: z.optional(z.string()),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand Down Expand Up @@ -677,6 +687,11 @@ export const TextContentSchema = z
* The text content of the message.
*/
text: z.string(),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand All @@ -694,6 +709,11 @@ export const ImageContentSchema = z
* The MIME type of the image. Different providers may support different image types.
*/
mimeType: z.string(),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand All @@ -711,6 +731,11 @@ export const AudioContentSchema = z
* The MIME type of the audio. Different providers may support different audio types.
*/
mimeType: z.string(),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand Down Expand Up @@ -847,12 +872,17 @@ export const ToolSchema = z
properties: z.optional(z.object({}).passthrough()),
required: z.optional(z.array(z.string())),
})
.passthrough()
.passthrough()
),
/**
* Optional additional tool information.
*/
annotations: z.optional(ToolAnnotationsSchema),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand Down Expand Up @@ -1182,6 +1212,11 @@ export const RootSchema = z
* An optional name for the root.
*/
name: z.optional(z.string()),

/**
* Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
*/
_meta: z.optional(z.object({}).passthrough()),
})
.passthrough();

Expand Down