feat(rmcp): add optional _meta to CallToolResult, EmbeddedResource, and ResourceContents (#386)

* feat(rmcp): support optional _meta on EmbeddedResource and ResourceContents

- Add optional _meta to RawEmbeddedResource and ResourceContents (text/blob)
- Update constructors/usages to set meta: None by default
- Add tests to lock behavior (embedded text/blob + CallToolResult)
- Update JSON Schemas to include optional _meta fields

* style(rmcp): rustfmt after _meta changes and tests
This commit is contained in:
Andrew Harvard 2025-09-02 13:47:09 -04:00 • committed by GitHub
commit 7d46b39b49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 311 additions and 3 deletions

View file

@ -892,6 +892,13 @@
"RawEmbeddedResource": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"resource": {
"$ref": "#/definitions/ResourceContents"
}
@ -1252,6 +1259,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"mimeType": {
"type": [
"string",
@ -1273,6 +1287,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"blob": {
"type": "string"
},

View file

@ -892,6 +892,13 @@
"RawEmbeddedResource": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"resource": {
"$ref": "#/definitions/ResourceContents"
}
@ -1252,6 +1259,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"mimeType": {
"type": [
"string",
@ -1273,6 +1287,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"blob": {
"type": "string"
},

View file

@ -181,6 +181,13 @@
"Annotated3": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"annotations": {
"anyOf": [
{
@ -319,6 +326,14 @@
"description": "The result of a tool call operation.\n\nContains the content returned by the tool execution and an optional\nflag indicating whether the operation resulted in an error.",
"type": "object",
"properties": {
"_meta": {
"description": "Optional protocol-level metadata for this result",
"type": [
"object",
"null"
],
"additionalProperties": true
},
"content": {
"description": "The content returned by the tool (text, images, etc.)",
"type": "array",
@ -1380,6 +1395,13 @@
"RawEmbeddedResource": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"resource": {
"$ref": "#/definitions/ResourceContents"
}
@ -1531,6 +1553,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"mimeType": {
"type": [
"string",
@ -1552,6 +1581,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"blob": {
"type": "string"
},

View file

@ -181,6 +181,13 @@
"Annotated3": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"annotations": {
"anyOf": [
{
@ -319,6 +326,14 @@
"description": "The result of a tool call operation.\n\nContains the content returned by the tool execution and an optional\nflag indicating whether the operation resulted in an error.",
"type": "object",
"properties": {
"_meta": {
"description": "Optional protocol-level metadata for this result",
"type": [
"object",
"null"
],
"additionalProperties": true
},
"content": {
"description": "The content returned by the tool (text, images, etc.)",
"type": "array",
@ -1380,6 +1395,13 @@
"RawEmbeddedResource": {
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"resource": {
"$ref": "#/definitions/ResourceContents"
}
@ -1531,6 +1553,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"mimeType": {
"type": [
"string",
@ -1552,6 +1581,13 @@
{
"type": "object",
"properties": {
"_meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"blob": {
"type": "string"
},