Skip to content

Commit 35d7253

Browse files
Code organization: consistent tool order everywhere
1 parent 80b3ac6 commit 35d7253

2 files changed

Lines changed: 43 additions & 43 deletions

File tree

src/everything/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
2727
- Returns: Completion message with duration and steps
2828
- Sends progress notifications during execution
2929

30-
4. `sampleLLM`
30+
4. `printEnv`
31+
- Prints all environment variables
32+
- Useful for debugging MCP server configuration
33+
- No inputs required
34+
- Returns: JSON string of all environment variables
35+
36+
5. `sampleLLM`
3137
- Demonstrates LLM sampling capability using MCP sampling feature
3238
- Inputs:
3339
- `prompt` (string): The prompt to send to the LLM
3440
- `maxTokens` (number, default: 100): Maximum tokens to generate
3541
- Returns: Generated LLM response
3642

37-
5. `getTinyImage`
43+
6. `getTinyImage`
3844
- Returns a small test image
3945
- No inputs required
4046
- Returns: Base64 encoded PNG image data
4147

42-
6. `printEnv`
43-
- Prints all environment variables
44-
- Useful for debugging MCP server configuration
45-
- No inputs required
46-
- Returns: JSON string of all environment variables
47-
4848
7. `annotatedMessage`
4949
- Demonstrates how annotations can be used to provide metadata about content
5050
- Inputs:

src/everything/everything.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)