Skip to main content
Glama

Get WSL environment variables

get_environment
Read-only

Retrieve WSL environment variables with optional filtering to view or export system settings for development workflows.

Instructions

Get WSL environment variables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter pattern (grep)

Implementation Reference

  • The handler function for the 'get_environment' tool. It runs 'env' or 'env | grep -i "filter"' in WSL via command_executor, formats the output using format_output, and returns it as text content or an error.
    async ({ filter }) => {
    	try {
    		const cmd = filter ? `env | grep -i "${filter}"` : 'env';
    		const result = await this.command_executor.execute_command(cmd);
    		return {
    			content: [
    				{
    					type: 'text' as const,
    					text: this.format_output(result),
    				},
    			],
    		};
    	} catch (error) {
    		return {
    			content: [
    				{
    					type: 'text' as const,
    					text: `Error: ${error instanceof Error ? error.message : String(error)}`,
    				},
    			],
    			isError: true,
    		};
    	}
    },
  • Valibot schema defining the optional 'filter' input parameter for the get_environment tool.
    schema: v.object({
    	filter: v.optional(
    		v.pipe(
    			v.string(),
    			v.description('Filter pattern (grep)'),
    		),
    	),
    }),
  • src/index.ts:144-184 (registration)
    Registration of the 'get_environment' tool on the MCP server, including name, description, read-only annotation, input schema, and inline handler function.
    this.server.tool(
    	{
    		name: 'get_environment',
    		description: 'Get WSL environment variables',
    		schema: v.object({
    			filter: v.optional(
    				v.pipe(
    					v.string(),
    					v.description('Filter pattern (grep)'),
    				),
    			),
    		}),
    		annotations: {
    			readOnlyHint: true,
    		},
    	},
    	async ({ filter }) => {
    		try {
    			const cmd = filter ? `env | grep -i "${filter}"` : 'env';
    			const result = await this.command_executor.execute_command(cmd);
    			return {
    				content: [
    					{
    						type: 'text' as const,
    						text: this.format_output(result),
    					},
    				],
    			};
    		} catch (error) {
    			return {
    				content: [
    					{
    						type: 'text' as const,
    						text: `Error: ${error instanceof Error ? error.message : String(error)}`,
    					},
    				],
    				isError: true,
    			};
    		}
    	},
    );
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already declare readOnlyHint=true, so the agent knows this is a safe read operation. The description doesn't add any behavioral context beyond what the annotations provide - no information about what specifically gets retrieved, how the filtering works, whether there are rate limits, or what the output format looks like. However, it doesn't contradict the annotations, so it earns a baseline score for not creating confusion while adding minimal value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words. While it's arguably too brief for adequate tool documentation, it contains zero wasted words and is perfectly front-loaded with the core purpose. Every word earns its place, making this maximally efficient in terms of word economy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema and only basic annotations, the description is incomplete. It doesn't explain what format the environment variables are returned in, whether it retrieves all variables or a subset, or how the filtering parameter interacts with the retrieval. While the schema covers the single parameter, the overall context for using this tool effectively is insufficient given the complexity of environment variable retrieval.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage with the 'filter' parameter clearly documented as 'Filter pattern (grep)'. The description itself provides no additional parameter information. With complete schema coverage, the baseline score of 3 is appropriate since the schema does all the parameter documentation work and the description doesn't need to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tautological: description restates name/title.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides absolutely no guidance about when to use this tool versus alternatives. There's no mention of when this tool is appropriate, when other tools might be better suited, or any prerequisites for its use. Given that there are multiple 'get_' sibling tools that retrieve different types of system information, this lack of differentiation guidance is a significant gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/spences10/mcp-wsl-exec'

If you have feedback or need assistance with the MCP directory API, please join our Discord server