Added printenv to the everything server to help debug environment variable configuration

This commit is contained in:
Jerome
2024-12-18 15:14:45 +00:00
parent 3ff22e8c3d
commit e198e36788

View File

@@ -40,6 +40,8 @@ const LongRunningOperationSchema = z.object({
steps: z.number().default(5).describe("Number of steps in the operation"),
});
const PrintEnvSchema = z.object({});
const SampleLLMSchema = z.object({
prompt: z.string().describe("The prompt to send to the LLM"),
maxTokens: z
@@ -54,6 +56,7 @@ enum ToolName {
ECHO = "echo",
ADD = "add",
LONG_RUNNING_OPERATION = "longRunningOperation",
PRINT_ENV = "printEnv",
SAMPLE_LLM = "sampleLLM",
GET_TINY_IMAGE = "getTinyImage",
}
@@ -297,6 +300,11 @@ export const createServer = () => {
description: "Adds two numbers",
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,
description:
@@ -374,6 +382,17 @@ export const createServer = () => {
};
}
if (name === ToolName.PRINT_ENV) {
return {
content: [
{
type: "text",
text: JSON.stringify(process.env, null, 2),
},
],
};
}
if (name === ToolName.SAMPLE_LLM) {
const validatedArgs = SampleLLMSchema.parse(args);
const { prompt, maxTokens } = validatedArgs;