@@ -790,14 +790,19 @@ export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
790790 blob : Base64Schema
791791} ) ;
792792
793+ /**
794+ * The sender or recipient of messages and data in a conversation.
795+ */
796+ export const RoleSchema = z . enum ( [ 'user' , 'assistant' ] ) ;
797+
793798/**
794799 * Optional annotations providing clients additional context about a resource.
795800 */
796801export const AnnotationsSchema = z . object ( {
797802 /**
798803 * Intended audience(s) for the resource.
799804 */
800- audience : z . array ( z . enum ( [ 'user' , 'assistant' ] ) ) . optional ( ) ,
805+ audience : z . array ( RoleSchema ) . optional ( ) ,
801806
802807 /**
803808 * Importance hint for the resource, from 0 (least) to 1 (most).
@@ -1200,7 +1205,7 @@ export const ContentBlockSchema = z.union([
12001205 * Describes a message returned as part of a prompt.
12011206 */
12021207export const PromptMessageSchema = z . object ( {
1203- role : z . enum ( [ 'user' , 'assistant' ] ) ,
1208+ role : RoleSchema ,
12041209 content : ContentBlockSchema
12051210} ) ;
12061211
@@ -1567,7 +1572,7 @@ export const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [
15671572 */
15681573export const SamplingMessageSchema = z
15691574 . object ( {
1570- role : z . enum ( [ 'user' , 'assistant' ] ) ,
1575+ role : RoleSchema ,
15711576 content : z . union ( [ SamplingMessageContentBlockSchema , z . array ( SamplingMessageContentBlockSchema ) ] ) ,
15721577 /**
15731578 * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
@@ -1651,7 +1656,7 @@ export const CreateMessageResultSchema = ResultSchema.extend({
16511656 * This field is an open string to allow for provider-specific stop reasons.
16521657 */
16531658 stopReason : z . optional ( z . enum ( [ 'endTurn' , 'stopSequence' , 'maxTokens' ] ) . or ( z . string ( ) ) ) ,
1654- role : z . enum ( [ 'user' , 'assistant' ] ) ,
1659+ role : RoleSchema ,
16551660 /**
16561661 * Response content. Single content block (text, image, or audio).
16571662 */
@@ -1679,7 +1684,7 @@ export const CreateMessageResultWithToolsSchema = ResultSchema.extend({
16791684 * This field is an open string to allow for provider-specific stop reasons.
16801685 */
16811686 stopReason : z . optional ( z . enum ( [ 'endTurn' , 'stopSequence' , 'maxTokens' , 'toolUse' ] ) . or ( z . string ( ) ) ) ,
1682- role : z . enum ( [ 'user' , 'assistant' ] ) ,
1687+ role : RoleSchema ,
16831688 /**
16841689 * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
16851690 */
@@ -2269,6 +2274,7 @@ export type Icon = Infer<typeof IconSchema>;
22692274export type Icons = Infer < typeof IconsSchema > ;
22702275export type BaseMetadata = Infer < typeof BaseMetadataSchema > ;
22712276export type Annotations = Infer < typeof AnnotationsSchema > ;
2277+ export type Role = Infer < typeof RoleSchema > ;
22722278
22732279/* Initialization */
22742280export type Implementation = Infer < typeof ImplementationSchema > ;
0 commit comments