@@ -20,7 +20,7 @@ import type {
2020 Result ,
2121 SchemaOutput
2222} from '@modelcontextprotocol/core' ;
23- import { CallToolResultSchema , ErrorCode , McpError , TaskClientPlugin } from '@modelcontextprotocol/core' ;
23+ import { CallToolResultSchema , ErrorCode , ProtocolError , TaskClientPlugin } from '@modelcontextprotocol/core' ;
2424
2525import type { Client } from '../../client/client.js' ;
2626
@@ -62,7 +62,7 @@ export class ExperimentalClientTasks<
6262 private _getTaskClient ( ) : TaskClientPlugin {
6363 const plugin = this . _client . getPlugin ( TaskClientPlugin ) ;
6464 if ( ! plugin ) {
65- throw new McpError (
65+ throw new ProtocolError (
6666 ErrorCode . InternalError ,
6767 'TaskClientPlugin not installed. Use client.usePlugin(new TaskClientPlugin()) first.'
6868 ) ;
@@ -137,7 +137,7 @@ export class ExperimentalClientTasks<
137137 if ( ! result . structuredContent && ! result . isError ) {
138138 yield {
139139 type : 'error' ,
140- error : new McpError (
140+ error : new ProtocolError (
141141 ErrorCode . InvalidRequest ,
142142 `Tool ${ params . name } has an output schema but did not return structured content`
143143 )
@@ -154,21 +154,21 @@ export class ExperimentalClientTasks<
154154 if ( ! validationResult . valid ) {
155155 yield {
156156 type : 'error' ,
157- error : new McpError (
157+ error : new ProtocolError (
158158 ErrorCode . InvalidParams ,
159159 `Structured content does not match the tool's output schema: ${ validationResult . errorMessage } `
160160 )
161161 } ;
162162 return ;
163163 }
164164 } catch ( error ) {
165- if ( error instanceof McpError ) {
165+ if ( error instanceof ProtocolError ) {
166166 yield { type : 'error' , error } ;
167167 return ;
168168 }
169169 yield {
170170 type : 'error' ,
171- error : new McpError (
171+ error : new ProtocolError (
172172 ErrorCode . InvalidParams ,
173173 `Failed to validate structured content: ${ error instanceof Error ? error . message : String ( error ) } `
174174 )
@@ -208,7 +208,7 @@ export class ExperimentalClientTasks<
208208 */
209209 async getTaskResult < T extends AnyObjectSchema > ( taskId : string , resultSchema ?: T , options ?: RequestOptions ) : Promise < SchemaOutput < T > > {
210210 if ( ! resultSchema ) {
211- throw new McpError ( ErrorCode . InvalidParams , 'resultSchema is required' ) ;
211+ throw new ProtocolError ( ErrorCode . InvalidParams , 'resultSchema is required' ) ;
212212 }
213213 return this . _getTaskClient ( ) . getTaskResult ( { taskId } , resultSchema , options ) ;
214214 }
0 commit comments