Skip to main content
Glama
Yonsn76

MyPos MCP

by Yonsn76

renombrarColumna

Change the name of an existing column in a database table by specifying the table, current column name, new name, and data type.

Instructions

Sigue estas reglas OBLIGATORIAS para renombrar una columna: ADVERTENCIA: Renombrar una columna es una acción delicada que puede romper consultas o código de aplicación que dependan de ella. Procede con cuidado. PROPÓSITO: Cambiar el nombre de una columna existente dentro de una tabla. REQUISITO: Debes proporcionar el tipo de dato de la columna junto con el nuevo nombre. USO: Especifica la tabla, el nombre actual, el nuevo nombre y el tipo de dato. EJEMPLO: "Renombra la columna nombre a nombre_completo en la tabla empleados."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnaActualYesNombre actual de la columna
nuevoNombreYesNuevo nombre para la columna
tablaYesNombre de la tabla
tipoYesTipo de la columna (ej. VARCHAR(255) NOT NULL)

Implementation Reference

  • Handler function for 'renombrarColumna' tool: validates params, builds database-specific ALTER TABLE SQL to rename column (CHANGE for MySQL requiring type, RENAME COLUMN for others), executes via query_runner.runQuery, returns success or error message.
    async ({ tabla, columnaActual, nuevoNombre, tipo }) => {
      try {
        if (!tabla || !columnaActual || !nuevoNombre || !tipo) {
          return { isError: true, content: [{ type: 'text', text: 'Debes proporcionar la tabla, columna actual, nuevo nombre y tipo.' }] };
        }
        let sql;
        if (db_type === 'mysql') {
          sql = `ALTER TABLE ${quoteIdent(tabla)} CHANGE ${quoteIdent(columnaActual)} ${quoteIdent(nuevoNombre)} ${tipo}`;
        } else {
          sql = `ALTER TABLE ${quoteIdent(tabla)} RENAME COLUMN ${quoteIdent(columnaActual)} TO ${quoteIdent(nuevoNombre)}`;
        }
        await query_runner.runQuery(sql);
        return { content: [{ type: 'text', text: `Columna renombrada de '${columnaActual}' a '${nuevoNombre}' exitosamente.` }] };
      } catch (e) {
        return { isError: true, content: [{ type: 'text', text: 'Error al renombrar la columna: ' + (e.message || e) }] };
      }
    }
  • Zod schema defining input parameters for the 'renombrarColumna' tool: tabla, columnaActual, nuevoNombre, tipo.
    {
      tabla: z.string().describe('Nombre de la tabla'),
      columnaActual: z.string().describe('Nombre actual de la columna'),
      nuevoNombre: z.string().describe('Nuevo nombre para la columna'),
      tipo: z.string().describe('Tipo de la columna (ej. VARCHAR(255) NOT NULL)'),
  • mcp_server.js:470-501 (registration)
    Registration of the 'renombrarColumna' tool using server.tool(), including description, schema, and handler function.
    server.tool(
      'renombrarColumna',
      'Sigue estas reglas OBLIGATORIAS para renombrar una columna:\n'
      + 'ADVERTENCIA: Renombrar una columna es una acción delicada que puede romper consultas o código de aplicación que dependan de ella. Procede con cuidado.\n'
      + 'PROPÓSITO: Cambiar el nombre de una columna existente dentro de una tabla.\n'
      + 'REQUISITO: Debes proporcionar el tipo de dato de la columna junto con el nuevo nombre.\n'
      + 'USO: Especifica la tabla, el nombre actual, el nuevo nombre y el tipo de dato.\n'
      + 'EJEMPLO: "Renombra la columna nombre a nombre_completo en la tabla empleados."',
      {
        tabla: z.string().describe('Nombre de la tabla'),
        columnaActual: z.string().describe('Nombre actual de la columna'),
        nuevoNombre: z.string().describe('Nuevo nombre para la columna'),
        tipo: z.string().describe('Tipo de la columna (ej. VARCHAR(255) NOT NULL)'),
      },
      async ({ tabla, columnaActual, nuevoNombre, tipo }) => {
        try {
          if (!tabla || !columnaActual || !nuevoNombre || !tipo) {
            return { isError: true, content: [{ type: 'text', text: 'Debes proporcionar la tabla, columna actual, nuevo nombre y tipo.' }] };
          }
          let sql;
          if (db_type === 'mysql') {
            sql = `ALTER TABLE ${quoteIdent(tabla)} CHANGE ${quoteIdent(columnaActual)} ${quoteIdent(nuevoNombre)} ${tipo}`;
          } else {
            sql = `ALTER TABLE ${quoteIdent(tabla)} RENAME COLUMN ${quoteIdent(columnaActual)} TO ${quoteIdent(nuevoNombre)}`;
          }
          await query_runner.runQuery(sql);
          return { content: [{ type: 'text', text: `Columna renombrada de '${columnaActual}' a '${nuevoNombre}' exitosamente.` }] };
        } catch (e) {
          return { isError: true, content: [{ type: 'text', text: 'Error al renombrar la columna: ' + (e.message || e) }] };
        }
      }
    );
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully warns about the delicate nature of the operation ('acción delicada que puede romper consultas o código'), which is crucial for a destructive mutation. However, it doesn't mention permissions, rollback capabilities, or response format, leaving some behavioral aspects unclear.

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

Conciseness3/5

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

The description is structured with clear sections (ADVERTENCIA, PROPÓSITO, REQUISITO, USO, EJEMPLO), which aids readability. However, it's somewhat verbose with repetitive information (e.g., the example largely restates the USO section), and the formatting with all-caps headings could be more streamlined.

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

Completeness4/5

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

For a mutation tool with no annotations and no output schema, the description does a good job covering the essential context: purpose, warning, parameter requirements, and usage example. It lacks details on permissions, error handling, and return values, but given the schema's full coverage and the clear behavioral warning, it's reasonably complete.

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

Parameters4/5

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

Schema description coverage is 100%, so the schema already documents all 4 parameters. The description adds value by emphasizing that 'tipo' is required ('REQUISITO: Debes proporcionar el tipo de dato') and providing an example format ('ej. VARCHAR(255) NOT NULL'), which goes beyond the schema's basic documentation.

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 explicitly states 'Cambiar el nombre de una columna existente dentro de una tabla' (Change the name of an existing column within a table), which is a specific verb+resource combination. It clearly distinguishes this from sibling tools like 'renombrarTabla' (rename table) and 'cambiarTipoColumna' (change column type), establishing its unique purpose.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with 'USO: Especifica la tabla, el nombre actual, el nuevo nombre y el tipo de dato' (USE: Specify the table, current name, new name, and data type). It also includes a concrete example and warns about when to be careful ('ADVERTENCIA: Renombrar una columna es una acción delicada...'), though it doesn't name specific alternatives among siblings.

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/Yonsn76/MyPos-MCP'

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