Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit ae21b0b

Browse files
committed
fix: update McpToolCallResponse type for SDK v1.26.0 compatibility
- Add resource_link content type variant to McpToolCallResponse union - Add optional annotations, _meta fields on all content item types - Add optional structuredContent field at top level - Handle resource_link content in UseMcpToolTool.processToolContent() Resolves TS2322 error where SDK CallToolResultSchema (with new resource_link type) was not assignable to McpToolCallResponse.
1 parent e3d1c2b commit ae21b0b

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

packages/types/src/mcp.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,48 @@ export type McpResourceResponse = {
9999
}>
100100
}
101101

102+
/**
103+
* Annotations that can be attached to content items in MCP tool call responses.
104+
* Used to indicate audience targeting, priority, and modification timestamps.
105+
*/
106+
export type McpContentAnnotations = {
107+
audience?: Array<"user" | "assistant">
108+
priority?: number
109+
lastModified?: string
110+
}
111+
102112
export type McpToolCallResponse = {
103113
_meta?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
104114
content: Array<
105115
| {
106116
type: "text"
107117
text: string
118+
annotations?: McpContentAnnotations
119+
_meta?: Record<string, unknown>
108120
}
109121
| {
110122
type: "image"
111123
data: string
112124
mimeType: string
125+
annotations?: McpContentAnnotations
126+
_meta?: Record<string, unknown>
113127
}
114128
| {
115129
type: "audio"
116130
data: string
117131
mimeType: string
132+
annotations?: McpContentAnnotations
133+
_meta?: Record<string, unknown>
134+
}
135+
| {
136+
type: "resource_link"
137+
uri: string
138+
name: string
139+
description?: string
140+
mimeType?: string
141+
title?: string
142+
annotations?: McpContentAnnotations
143+
_meta?: Record<string, unknown>
118144
}
119145
| {
120146
type: "resource"
@@ -123,9 +149,13 @@ export type McpToolCallResponse = {
123149
mimeType?: string
124150
text?: string
125151
blob?: string
152+
_meta?: Record<string, unknown>
126153
}
154+
annotations?: McpContentAnnotations
155+
_meta?: Record<string, unknown>
127156
}
128157
>
158+
structuredContent?: Record<string, unknown>
129159
isError?: boolean
130160
}
131161

src/core/tools/UseMcpToolTool.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ export class UseMcpToolTool extends BaseTool<"use_mcp_tool"> {
271271
const { blob: _, ...rest } = item.resource
272272
return JSON.stringify(rest, null, 2)
273273
}
274+
if (item.type === "resource_link") {
275+
const { uri, name, description, mimeType } = item
276+
const parts: Record<string, string> = { uri, name }
277+
if (description) parts.description = description
278+
if (mimeType) parts.mimeType = mimeType
279+
return JSON.stringify(parts, null, 2)
280+
}
274281
if (item.type === "image") {
275282
// Handle image content (MCP image content has mimeType and data properties)
276283
if (item.mimeType && item.data) {

0 commit comments

Comments
 (0)