@@ -428,18 +428,18 @@ export const createServer = () => {
428428 description : "Adds two numbers" ,
429429 inputSchema : zodToJsonSchema ( AddSchema ) as ToolInput ,
430430 } ,
431- {
432- name : ToolName . PRINT_ENV ,
433- description :
434- "Prints all environment variables, helpful for debugging MCP server configuration" ,
435- inputSchema : zodToJsonSchema ( PrintEnvSchema ) as ToolInput ,
436- } ,
437431 {
438432 name : ToolName . LONG_RUNNING_OPERATION ,
439433 description :
440434 "Demonstrates a long running operation with progress updates" ,
441435 inputSchema : zodToJsonSchema ( LongRunningOperationSchema ) as ToolInput ,
442436 } ,
437+ {
438+ name : ToolName . PRINT_ENV ,
439+ description :
440+ "Prints all environment variables, helpful for debugging MCP server configuration" ,
441+ inputSchema : zodToJsonSchema ( PrintEnvSchema ) as ToolInput ,
442+ } ,
443443 {
444444 name : ToolName . SAMPLE_LLM ,
445445 description : "Samples from an LLM using MCP's sampling feature" ,
@@ -571,35 +571,6 @@ export const createServer = () => {
571571 } ;
572572 }
573573
574- if ( name === ToolName . GET_RESOURCE_REFERENCE ) {
575- const validatedArgs = GetResourceReferenceSchema . parse ( args ) ;
576- const resourceId = validatedArgs . resourceId ;
577-
578- const resourceIndex = resourceId - 1 ;
579- if ( resourceIndex < 0 || resourceIndex >= ALL_RESOURCES . length ) {
580- throw new Error ( `Resource with ID ${ resourceId } does not exist` ) ;
581- }
582-
583- const resource = ALL_RESOURCES [ resourceIndex ] ;
584-
585- return {
586- content : [
587- {
588- type : "text" ,
589- text : `Returning resource reference for Resource ${ resourceId } :` ,
590- } ,
591- {
592- type : "resource" ,
593- resource : resource ,
594- } ,
595- {
596- type : "text" ,
597- text : `You can access this resource using the URI: ${ resource . uri } ` ,
598- } ,
599- ] ,
600- } ;
601- }
602-
603574 if ( name === ToolName . ANNOTATED_MESSAGE ) {
604575 const { messageType, includeImage } = AnnotatedMessageSchema . parse ( args ) ;
605576
@@ -651,6 +622,35 @@ export const createServer = () => {
651622 return { content } ;
652623 }
653624
625+ if ( name === ToolName . GET_RESOURCE_REFERENCE ) {
626+ const validatedArgs = GetResourceReferenceSchema . parse ( args ) ;
627+ const resourceId = validatedArgs . resourceId ;
628+
629+ const resourceIndex = resourceId - 1 ;
630+ if ( resourceIndex < 0 || resourceIndex >= ALL_RESOURCES . length ) {
631+ throw new Error ( `Resource with ID ${ resourceId } does not exist` ) ;
632+ }
633+
634+ const resource = ALL_RESOURCES [ resourceIndex ] ;
635+
636+ return {
637+ content : [
638+ {
639+ type : "text" ,
640+ text : `Returning resource reference for Resource ${ resourceId } :` ,
641+ } ,
642+ {
643+ type : "resource" ,
644+ resource : resource ,
645+ } ,
646+ {
647+ type : "text" ,
648+ text : `You can access this resource using the URI: ${ resource . uri } ` ,
649+ } ,
650+ ] ,
651+ } ;
652+ }
653+
654654 throw new Error ( `Unknown tool: ${ name } ` ) ;
655655 } ) ;
656656
0 commit comments