@@ -123,6 +123,7 @@ export class McpServer {
123
123
} ) as Tool [ "inputSchema" ] )
124
124
: EMPTY_OBJECT_JSON_SCHEMA ,
125
125
annotations : tool . annotations ,
126
+ _meta : tool . _meta ,
126
127
} ;
127
128
128
129
if ( tool . outputSchema ) {
@@ -773,6 +774,7 @@ export class McpServer {
773
774
inputSchema : ZodRawShape | undefined ,
774
775
outputSchema : ZodRawShape | undefined ,
775
776
annotations : ToolAnnotations | undefined ,
777
+ _meta : Record < string , unknown > | undefined ,
776
778
callback : ToolCallback < ZodRawShape | undefined >
777
779
) : RegisteredTool {
778
780
const registeredTool : RegisteredTool = {
@@ -783,6 +785,7 @@ export class McpServer {
783
785
outputSchema :
784
786
outputSchema === undefined ? undefined : z . object ( outputSchema ) ,
785
787
annotations,
788
+ _meta,
786
789
callback,
787
790
enabled : true ,
788
791
disable : ( ) => registeredTool . update ( { enabled : false } ) ,
@@ -798,6 +801,7 @@ export class McpServer {
798
801
if ( typeof updates . paramsSchema !== "undefined" ) registeredTool . inputSchema = z . object ( updates . paramsSchema )
799
802
if ( typeof updates . callback !== "undefined" ) registeredTool . callback = updates . callback
800
803
if ( typeof updates . annotations !== "undefined" ) registeredTool . annotations = updates . annotations
804
+ if ( typeof updates . _meta !== "undefined" ) registeredTool . _meta = updates . _meta
801
805
if ( typeof updates . enabled !== "undefined" ) registeredTool . enabled = updates . enabled
802
806
this . sendToolListChanged ( )
803
807
} ,
@@ -915,7 +919,7 @@ export class McpServer {
915
919
}
916
920
const callback = rest [ 0 ] as ToolCallback < ZodRawShape | undefined > ;
917
921
918
- return this . _createRegisteredTool ( name , undefined , description , inputSchema , outputSchema , annotations , callback )
922
+ return this . _createRegisteredTool ( name , undefined , description , inputSchema , outputSchema , annotations , undefined , callback )
919
923
}
920
924
921
925
/**
@@ -929,14 +933,15 @@ export class McpServer {
929
933
inputSchema ?: InputArgs ;
930
934
outputSchema ?: OutputArgs ;
931
935
annotations ?: ToolAnnotations ;
936
+ _meta ?: Record < string , unknown > ;
932
937
} ,
933
938
cb : ToolCallback < InputArgs >
934
939
) : RegisteredTool {
935
940
if ( this . _registeredTools [ name ] ) {
936
941
throw new Error ( `Tool ${ name } is already registered` ) ;
937
942
}
938
943
939
- const { title, description, inputSchema, outputSchema, annotations } = config ;
944
+ const { title, description, inputSchema, outputSchema, annotations, _meta } = config ;
940
945
941
946
return this . _createRegisteredTool (
942
947
name ,
@@ -945,6 +950,7 @@ export class McpServer {
945
950
inputSchema ,
946
951
outputSchema ,
947
952
annotations ,
953
+ _meta ,
948
954
cb as ToolCallback < ZodRawShape | undefined >
949
955
) ;
950
956
}
@@ -1173,6 +1179,7 @@ export type RegisteredTool = {
1173
1179
inputSchema ?: AnyZodObject ;
1174
1180
outputSchema ?: AnyZodObject ;
1175
1181
annotations ?: ToolAnnotations ;
1182
+ _meta ?: Record < string , unknown > ;
1176
1183
callback : ToolCallback < undefined | ZodRawShape > ;
1177
1184
enabled : boolean ;
1178
1185
enable ( ) : void ;
@@ -1185,6 +1192,7 @@ export type RegisteredTool = {
1185
1192
paramsSchema ?: InputArgs ,
1186
1193
outputSchema ?: OutputArgs ,
1187
1194
annotations ?: ToolAnnotations ,
1195
+ _meta ?: Record < string , unknown > ,
1188
1196
callback ?: ToolCallback < InputArgs > ,
1189
1197
enabled ?: boolean
1190
1198
} ) : void
0 commit comments