@@ -123,6 +123,7 @@ export class McpServer {
123123 } ) as Tool [ "inputSchema" ] )
124124 : EMPTY_OBJECT_JSON_SCHEMA ,
125125 annotations : tool . annotations ,
126+ _meta : tool . _meta ,
126127 } ;
127128
128129 if ( tool . outputSchema ) {
@@ -773,6 +774,7 @@ export class McpServer {
773774 inputSchema : ZodRawShape | undefined ,
774775 outputSchema : ZodRawShape | undefined ,
775776 annotations : ToolAnnotations | undefined ,
777+ _meta : Record < string , unknown > | undefined ,
776778 callback : ToolCallback < ZodRawShape | undefined >
777779 ) : RegisteredTool {
778780 const registeredTool : RegisteredTool = {
@@ -783,6 +785,7 @@ export class McpServer {
783785 outputSchema :
784786 outputSchema === undefined ? undefined : z . object ( outputSchema ) ,
785787 annotations,
788+ _meta,
786789 callback,
787790 enabled : true ,
788791 disable : ( ) => registeredTool . update ( { enabled : false } ) ,
@@ -798,6 +801,7 @@ export class McpServer {
798801 if ( typeof updates . paramsSchema !== "undefined" ) registeredTool . inputSchema = z . object ( updates . paramsSchema )
799802 if ( typeof updates . callback !== "undefined" ) registeredTool . callback = updates . callback
800803 if ( typeof updates . annotations !== "undefined" ) registeredTool . annotations = updates . annotations
804+ if ( typeof updates . _meta !== "undefined" ) registeredTool . _meta = updates . _meta
801805 if ( typeof updates . enabled !== "undefined" ) registeredTool . enabled = updates . enabled
802806 this . sendToolListChanged ( )
803807 } ,
@@ -915,7 +919,7 @@ export class McpServer {
915919 }
916920 const callback = rest [ 0 ] as ToolCallback < ZodRawShape | undefined > ;
917921
918- return this . _createRegisteredTool ( name , undefined , description , inputSchema , outputSchema , annotations , callback )
922+ return this . _createRegisteredTool ( name , undefined , description , inputSchema , outputSchema , annotations , undefined , callback )
919923 }
920924
921925 /**
@@ -929,14 +933,15 @@ export class McpServer {
929933 inputSchema ?: InputArgs ;
930934 outputSchema ?: OutputArgs ;
931935 annotations ?: ToolAnnotations ;
936+ _meta ?: Record < string , unknown > ;
932937 } ,
933938 cb : ToolCallback < InputArgs >
934939 ) : RegisteredTool {
935940 if ( this . _registeredTools [ name ] ) {
936941 throw new Error ( `Tool ${ name } is already registered` ) ;
937942 }
938943
939- const { title, description, inputSchema, outputSchema, annotations } = config ;
944+ const { title, description, inputSchema, outputSchema, annotations, _meta } = config ;
940945
941946 return this . _createRegisteredTool (
942947 name ,
@@ -945,6 +950,7 @@ export class McpServer {
945950 inputSchema ,
946951 outputSchema ,
947952 annotations ,
953+ _meta ,
948954 cb as ToolCallback < ZodRawShape | undefined >
949955 ) ;
950956 }
@@ -1173,6 +1179,7 @@ export type RegisteredTool = {
11731179 inputSchema ?: AnyZodObject ;
11741180 outputSchema ?: AnyZodObject ;
11751181 annotations ?: ToolAnnotations ;
1182+ _meta ?: Record < string , unknown > ;
11761183 callback : ToolCallback < undefined | ZodRawShape > ;
11771184 enabled : boolean ;
11781185 enable ( ) : void ;
@@ -1185,6 +1192,7 @@ export type RegisteredTool = {
11851192 paramsSchema ?: InputArgs ,
11861193 outputSchema ?: OutputArgs ,
11871194 annotations ?: ToolAnnotations ,
1195+ _meta ?: Record < string , unknown > ,
11881196 callback ?: ToolCallback < InputArgs > ,
11891197 enabled ?: boolean
11901198 } ) : void
0 commit comments