chore: Code organization: consistent tool order everywhere
This commit is contained in:
parent
7ec0064157
commit
bb1b418da1
2 changed files with 47 additions and 47 deletions
|
|
@ -27,24 +27,24 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
|
||||||
- Returns: Completion message with duration and steps
|
- Returns: Completion message with duration and steps
|
||||||
- Sends progress notifications during execution
|
- Sends progress notifications during execution
|
||||||
|
|
||||||
4. `sampleLLM`
|
4. `printEnv`
|
||||||
|
- Prints all environment variables
|
||||||
|
- Useful for debugging MCP server configuration
|
||||||
|
- No inputs required
|
||||||
|
- Returns: JSON string of all environment variables
|
||||||
|
|
||||||
|
5. `sampleLLM`
|
||||||
- Demonstrates LLM sampling capability using MCP sampling feature
|
- Demonstrates LLM sampling capability using MCP sampling feature
|
||||||
- Inputs:
|
- Inputs:
|
||||||
- `prompt` (string): The prompt to send to the LLM
|
- `prompt` (string): The prompt to send to the LLM
|
||||||
- `maxTokens` (number, default: 100): Maximum tokens to generate
|
- `maxTokens` (number, default: 100): Maximum tokens to generate
|
||||||
- Returns: Generated LLM response
|
- Returns: Generated LLM response
|
||||||
|
|
||||||
5. `getTinyImage`
|
6. `getTinyImage`
|
||||||
- Returns a small test image
|
- Returns a small test image
|
||||||
- No inputs required
|
- No inputs required
|
||||||
- Returns: Base64 encoded PNG image data
|
- Returns: Base64 encoded PNG image data
|
||||||
|
|
||||||
6. `printEnv`
|
|
||||||
- Prints all environment variables
|
|
||||||
- Useful for debugging MCP server configuration
|
|
||||||
- No inputs required
|
|
||||||
- Returns: JSON string of all environment variables
|
|
||||||
|
|
||||||
7. `annotatedMessage`
|
7. `annotatedMessage`
|
||||||
- Demonstrates how annotations can be used to provide metadata about content
|
- Demonstrates how annotations can be used to provide metadata about content
|
||||||
- Inputs:
|
- Inputs:
|
||||||
|
|
|
||||||
|
|
@ -457,18 +457,18 @@ export const createServer = () => {
|
||||||
description: "Adds two numbers",
|
description: "Adds two numbers",
|
||||||
inputSchema: zodToJsonSchema(AddSchema) as ToolInput,
|
inputSchema: zodToJsonSchema(AddSchema) as ToolInput,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: ToolName.PRINT_ENV,
|
|
||||||
description:
|
|
||||||
"Prints all environment variables, helpful for debugging MCP server configuration",
|
|
||||||
inputSchema: zodToJsonSchema(PrintEnvSchema) as ToolInput,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: ToolName.LONG_RUNNING_OPERATION,
|
name: ToolName.LONG_RUNNING_OPERATION,
|
||||||
description:
|
description:
|
||||||
"Demonstrates a long running operation with progress updates",
|
"Demonstrates a long running operation with progress updates",
|
||||||
inputSchema: zodToJsonSchema(LongRunningOperationSchema) as ToolInput,
|
inputSchema: zodToJsonSchema(LongRunningOperationSchema) as ToolInput,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: ToolName.PRINT_ENV,
|
||||||
|
description:
|
||||||
|
"Prints all environment variables, helpful for debugging MCP server configuration",
|
||||||
|
inputSchema: zodToJsonSchema(PrintEnvSchema) as ToolInput,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: ToolName.SAMPLE_LLM,
|
name: ToolName.SAMPLE_LLM,
|
||||||
description: "Samples from an LLM using MCP's sampling feature",
|
description: "Samples from an LLM using MCP's sampling feature",
|
||||||
|
|
@ -611,35 +611,6 @@ export const createServer = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === ToolName.GET_RESOURCE_REFERENCE) {
|
|
||||||
const validatedArgs = GetResourceReferenceSchema.parse(args);
|
|
||||||
const resourceId = validatedArgs.resourceId;
|
|
||||||
|
|
||||||
const resourceIndex = resourceId - 1;
|
|
||||||
if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
|
|
||||||
throw new Error(`Resource with ID ${resourceId} does not exist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const resource = ALL_RESOURCES[resourceIndex];
|
|
||||||
|
|
||||||
return {
|
|
||||||
content: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: `Returning resource reference for Resource ${resourceId}:`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "resource",
|
|
||||||
resource: resource,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: `You can access this resource using the URI: ${resource.uri}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === ToolName.ANNOTATED_MESSAGE) {
|
if (name === ToolName.ANNOTATED_MESSAGE) {
|
||||||
const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
|
const { messageType, includeImage } = AnnotatedMessageSchema.parse(args);
|
||||||
|
|
||||||
|
|
@ -691,6 +662,35 @@ export const createServer = () => {
|
||||||
return { content };
|
return { content };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name === ToolName.GET_RESOURCE_REFERENCE) {
|
||||||
|
const validatedArgs = GetResourceReferenceSchema.parse(args);
|
||||||
|
const resourceId = validatedArgs.resourceId;
|
||||||
|
|
||||||
|
const resourceIndex = resourceId - 1;
|
||||||
|
if (resourceIndex < 0 || resourceIndex >= ALL_RESOURCES.length) {
|
||||||
|
throw new Error(`Resource with ID ${resourceId} does not exist`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const resource = ALL_RESOURCES[resourceIndex];
|
||||||
|
|
||||||
|
return {
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `Returning resource reference for Resource ${resourceId}:`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "resource",
|
||||||
|
resource: resource,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: `You can access this resource using the URI: ${resource.uri}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (name === ToolName.ELICITATION) {
|
if (name === ToolName.ELICITATION) {
|
||||||
ElicitationSchema.parse(args);
|
ElicitationSchema.parse(args);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue