printEnv
Displays all environment variables for debugging server configurations on the MCP Elicitations Demo Server, aiding in dynamic user input setups.
Instructions
Prints all environment variables, helpful for debugging MCP server configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/tool-print-env.ts:10-19 (handler)The async handler function for the printEnv tool, which returns all environment variables as a formatted JSON string in a text content block.handler: async (args: any) => { return { content: [ { type: "text" as const, text: JSON.stringify(process.env, null, 2), }, ], }; },
- src/tools/tool-print-env.ts:4-4 (schema)Zod schema definition for the printEnv tool input, which accepts no parameters (empty object).const PrintEnvSchema = z.object({});
- src/tools/index.ts:22-37 (registration)The allTools array that aggregates all tool objects, including printEnvTool, for use in tool listing and handler lookup.const allTools = [ echoTool, addTool, longRunningOperationTool, printEnvTool, sampleLlmTool, sampleWithPreferencesTool, sampleMultimodalTool, sampleConversationTool, sampleAdvancedTool, getTinyImageTool, annotatedMessageTool, getResourceReferenceTool, elicitationTool, getResourceLinksTool, ];
- src/tools/index.ts:53-70 (registration)Registers the MCP protocol request handlers for listing tools and calling tools on the server, enabling execution of printEnv via getToolHandler.export const setupTools = (server: Server) => { // Handle listing all available tools server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: getTools() }; }); // Handle tool execution server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = getToolHandler(name); if (handler) { return await handler(args, request, server); } throw new Error(`Unknown tool: ${name}`); }); };
- src/everything.ts:98-98 (registration)Calls setupTools on the main server instance, finalizing the registration of all tools including printEnv.setupTools(server);