Skip to main content
Glama

env_rename

Rename an environment in your API testing setup; if it is currently active, the reference updates automatically.

Instructions

Renombra un entorno existente. Si es el entorno activo, actualiza la referencia.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesNombre actual del entorno
new_nameYesNuevo nombre para el entorno

Implementation Reference

  • Handler for env_rename tool. Receives {name, new_name}, calls storage.renameEnvironment(), and returns success/error message.
    server.tool(
      'env_rename',
      'Renombra un entorno existente. Si es el entorno activo, actualiza la referencia.',
      {
        name: z.string().describe('Nombre actual del entorno'),
        new_name: z.string().describe('Nuevo nombre para el entorno'),
      },
      async (params) => {
        try {
          await storage.renameEnvironment(params.name, params.new_name)
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `Entorno '${params.name}' renombrado a '${params.new_name}'`,
              },
            ],
          }
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error)
          return {
            content: [{ type: 'text' as const, text: `Error: ${message}` }],
            isError: true,
          }
        }
      },
    )
    
    // ── env_delete ──
  • Input schema for env_rename: name (current name) and new_name (new name), both strings.
    {
      name: z.string().describe('Nombre actual del entorno'),
      new_name: z.string().describe('Nuevo nombre para el entorno'),
    },
  • Storage helper renameEnvironment() that validates existence of old env, no conflict with new name, renames the JSON file, updates project-envs references, and updates group default if needed.
    async renameEnvironment(oldName: string, newName: string): Promise<void> {
      const env = await this.getEnvironment(oldName)
      if (!env) {
        throw new Error(`Entorno '${oldName}' no encontrado`)
      }
    
      const existing = await this.getEnvironment(newName)
      if (existing) {
        throw new Error(`Ya existe un entorno con el nombre '${newName}'`)
      }
    
      env.name = newName
      env.updatedAt = new Date().toISOString()
      await this.createEnvironment(env)
      await unlink(join(this.environmentsDir, `${this.sanitizeName(oldName)}.json`))
    
      // Actualizar project-envs
      const projectEnvs = await this.getProjectEnvs()
      let changed = false
      for (const [project, envName] of Object.entries(projectEnvs)) {
        if (envName === oldName) {
          projectEnvs[project] = newName
          changed = true
        }
      }
      if (changed) {
        await this.writeJson(this.projectEnvsFile, projectEnvs)
      }
    
      // Actualizar default del grupo si era el default
      if (env.group) {
        const group = await this.getGroup(env.group)
        if (group?.default === oldName) {
          group.default = newName
          group.updatedAt = new Date().toISOString()
          await this.saveGroup(group)
        }
      }
    }
  • Registration of 'env_rename' tool via server.tool() inside registerEnvironmentTools().
    server.tool(
      'env_rename',
  • src/server.ts:64-64 (registration)
    Top-level registration: registerEnvironmentTools(server, storage) is called in server.ts to register all environment tools including env_rename.
    registerEnvironmentTools(server, storage)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses a key behavioral trait: updating the reference if it's the active environment. However, it omits other potential side effects (e.g., cascading updates to groups or projects) or permission requirements, making it moderately transparent.

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

Conciseness4/5

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

The description is concise with two sentences, no filler. It is front-loaded with the main action and ends with a specific condition. It could be slightly improved by separating the condition, but overall it is well-structured.

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

Completeness3/5

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

Given the absence of an output schema, the description could mention what the tool returns. The operation is simple, and the description covers the core behavior, but lacks return value details. It is adequate but not fully complete.

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?

Schema coverage is 100%, and both parameters have descriptions in the schema. The description does not add any additional meaning beyond what the schema already provides. Therefore, the baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'renombra' (rename) and the resource 'entorno existente' (existing environment). It also adds a specific behavioral note about updating the reference if it is the active environment, which distinguishes it from sibling tools like env_create or env_delete.

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 does not provide any guidance on when to use this tool versus alternatives (e.g., env_set or env_create for renaming). No when-not-to-use or context is given, leaving the agent without direction.

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/cocaxcode/api-testing-mcp'

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