Replace mcp_core::content types with rmcp::model types (#3500)

This commit is contained in:
Jack Amadeo
2025-07-18 17:23:25 -04:00
committed by GitHub
parent a2309d9436
commit d5291461ca
66 changed files with 867 additions and 856 deletions
+77 -73
View File
@@ -934,18 +934,14 @@
"type": "array",
"items": {
"$ref": "#/components/schemas/Role"
},
"nullable": true
}
},
"priority": {
"type": "number",
"format": "float",
"nullable": true
"type": "number"
},
"timestamp": {
"type": "string",
"format": "date-time",
"example": "2023-01-01T00:00:00Z"
"format": "date-time"
}
}
},
@@ -1002,72 +998,81 @@
"Content": {
"oneOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/TextContent"
"type": "object",
"required": [
"text",
"type"
],
"properties": {
"text": {
"type": "string"
},
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"text"
]
}
}
"type": {
"type": "string"
}
]
}
},
{
"allOf": [
{
"$ref": "#/components/schemas/ImageContent"
"type": "object",
"required": [
"data",
"mimeType",
"type"
],
"properties": {
"data": {
"type": "string"
},
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"image"
]
}
}
"mimeType": {
"type": "string"
},
"type": {
"type": "string"
}
]
}
},
{
"allOf": [
{
"$ref": "#/components/schemas/EmbeddedResource"
"type": "object",
"required": [
"resource",
"type"
],
"properties": {
"resource": {
"$ref": "#/components/schemas/ResourceContents"
},
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"resource"
]
}
}
"type": {
"type": "string"
}
]
}
},
{
"type": "object",
"required": [
"data",
"mimeType",
"type"
],
"properties": {
"annotations": {
"allOf": [
{
"$ref": "#/components/schemas/Annotations"
}
]
},
"data": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
],
"discriminator": {
"propertyName": "type"
}
]
},
"ContextLengthExceeded": {
"type": "object",
@@ -1160,8 +1165,7 @@
{
"$ref": "#/components/schemas/Annotations"
}
],
"nullable": true
]
},
"resource": {
"$ref": "#/components/schemas/ResourceContents"
@@ -1491,8 +1495,7 @@
{
"$ref": "#/components/schemas/Annotations"
}
],
"nullable": true
]
},
"data": {
"type": "string"
@@ -1997,11 +2000,13 @@
]
},
"Role": {
"type": "string",
"description": "A wrapper around rmcp::model::Role that implements ToSchema for utoipa",
"enum": [
"user",
"assistant"
"oneOf": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"RunNowResponse": {
@@ -2285,8 +2290,7 @@
{
"$ref": "#/components/schemas/Annotations"
}
],
"nullable": true
]
},
"text": {
"type": "string"
+22 -16
View File
@@ -1,8 +1,8 @@
// This file is auto-generated by @hey-api/openapi-ts
export type Annotations = {
audience?: Array<Role> | null;
priority?: number | null;
audience?: Array<Role>;
priority?: number;
timestamp?: string;
};
@@ -22,13 +22,22 @@ export type ConfigResponse = {
config: {};
};
export type Content = (TextContent & {
type: 'text';
}) | (ImageContent & {
type: 'image';
}) | (EmbeddedResource & {
type: 'resource';
});
export type Content = {
text: string;
type: string;
} | {
data: string;
mimeType: string;
type: string;
} | {
resource: ResourceContents;
type: string;
} | {
annotations?: Annotations;
data: string;
mimeType: string;
type: string;
};
export type ContextLengthExceeded = {
msg: string;
@@ -70,7 +79,7 @@ export type CreateScheduleRequest = {
};
export type EmbeddedResource = {
annotations?: Annotations | null;
annotations?: Annotations;
resource: ResourceContents;
};
@@ -186,7 +195,7 @@ export type FrontendToolRequest = {
};
export type ImageContent = {
annotations?: Annotations | null;
annotations?: Annotations;
data: string;
mimeType: string;
};
@@ -338,10 +347,7 @@ export type ResourceContents = {
uri: string;
};
/**
* A wrapper around rmcp::model::Role that implements ToSchema for utoipa
*/
export type Role = 'user' | 'assistant';
export type Role = string;
export type RunNowResponse = {
session_id: string;
@@ -459,7 +465,7 @@ export type SummarizationRequested = {
};
export type TextContent = {
annotations?: Annotations | null;
annotations?: Annotations;
text: string;
};
@@ -59,7 +59,7 @@ export function convertApiMessageToFrontendMessage(
display: display ?? true,
sendToLLM: sendToLLM ?? true,
id: generateId(),
role: apiMessage.role,
role: apiMessage.role as Role,
created: apiMessage.created,
content: apiMessage.content
.map((apiContent) => mapApiContentToFrontendMessageContent(apiContent))