Skip to main content
Glama
martin-1103
by martin-1103

set_default_environment

Set a specific environment as the default for your project to ensure consistent API testing and development workflows across your team.

Instructions

Set an environment as the default for the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesEnvironment ID to set as default

Implementation Reference

  • Core implementation of the set_default_environment tool. Validates environmentId, initializes BackendClient and EnvironmentService, calls setDefaultEnvironment on the service, and returns formatted MCPToolResponse.
    export async function handleSetDefaultEnvironment(args: any): Promise<McpToolResponse> {
      try {
        const { environmentId } = args;
    
        if (!environmentId) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Environment ID is required'
                }, null, 2)
              }
            ]
          };
        }
    
        const instances = await getInstances();
    
        // Create environment service
        const envService = new EnvironmentService(
          instances.backendClient.getBaseUrl(),
          instances.backendClient.getToken()
        );
    
        // Set as default
        const success = await envService.setDefaultEnvironment(environmentId);
    
        if (!success) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Failed to set environment as default'
                }, null, 2)
              }
            ]
          };
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                message: 'Environment set as default successfully',
                data: {
                  environmentId,
                  setAt: new Date().toISOString()
                }
              }, null, 2)
            }
          ]
        };
    
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: error.message || 'Unknown error occurred while setting default environment'
              }, null, 2)
            }
          ]
        };
      }
    }
  • MCP tool definition including name, description, input schema (requiring environmentId string), and reference to handler.
    export const setDefaultEnvironmentTool: McpTool = {
      name: 'set_default_environment',
      description: 'Set an environment as the default for the project',
      inputSchema: {
        type: 'object',
        properties: {
          environmentId: {
            type: 'string',
            description: 'Environment ID to set as default'
          }
        },
        required: ['environmentId']
      },
      handler: handleSetDefaultEnvironment
    };
  • Registers setDefaultEnvironmentTool in the environmentTools array, which is exported and included in main ALL_TOOLS.
    export const environmentTools = [
      listEnvironmentsTool,
      getEnvironmentDetailsTool,
      createEnvironmentTool,
      updateEnvironmentVariablesTool,
      setDefaultEnvironmentTool,
      deleteEnvironmentTool
  • Dynamic handler registration in main tools index, importing and delegating to the core handler function.
    'set_default_environment': async (args: any) => {
      const { handleSetDefaultEnvironment } = await import('./environment/handlers/updateHandler.js');
      return handleSetDefaultEnvironment(args);
    },
  • Main tool registry including environmentTools (which contains setDefaultEnvironmentTool) in ALL_TOOLS.
    export const ALL_TOOLS: McpTool[] = [
      ...CORE_TOOLS,
      ...AUTH_TOOLS,
      ...environmentTools,
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states a mutation action ('Set'), implying changes to project settings, but doesn't disclose behavioral traits like required permissions, whether the change is reversible, or potential side effects. This leaves significant gaps for a tool that modifies defaults.

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 a single, direct sentence that efficiently conveys the core action without unnecessary words. It is front-loaded and appropriately sized for the tool's complexity, with zero waste.

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?

Given the tool's mutation nature and lack of annotations or output schema, the description is incomplete. It doesn't address what happens after setting the default (e.g., confirmation, error handling, or impact on other operations), leaving the agent with insufficient context for reliable use.

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 single parameter 'environmentId' documented as 'Environment ID to set as default'. The description adds no additional meaning beyond this, so it meets the baseline for high schema coverage without compensating further.

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

Purpose4/5

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

The description clearly states the action ('Set') and the target ('an environment as the default for the project'), making the purpose understandable. However, it doesn't explicitly differentiate from siblings like 'update_environment_variables' or 'create_environment', which could be ambiguous in context.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as whether it should be used after creating an environment or instead of other update operations. Without any context on prerequisites or exclusions, usage is implied but not clarified.

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/martin-1103/mcp2'

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