Skip to main content
Glama
Yonsn76

MyPos MCP

by Yonsn76

cambiarTipoColumna

Change the data type of a column in MySQL or PostgreSQL databases. Requires explicit confirmation to prevent data loss during type conversion.

Instructions

Sigue estas reglas OBLIGATORIAS para cambiar el tipo de una columna: ADVERTENCIA INICIAL: Informa al usuario que cambiar el tipo de dato de una columna es una acción PELIGROSA que puede resultar en PÉRDIDA DE DATOS si la conversión no es compatible. CONFIRMACIÓN EXPLÍCITA: Para proceder, el usuario DEBE escribir la frase exacta: "Confirmar cambio de tipo para la columna [nombreColumna] a [nuevoTipo]". VERIFICACIÓN ESTRICTA: No ejecutes la modificación si la confirmación no es exacta. USO: Especifica la tabla, la columna y el nuevo tipo de dato. EJEMPLO: "Cambia el tipo de la columna fecha a DATE en la tabla ventas."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnaYesNombre de la columna a modificar
nuevoTipoYesNuevo tipo de datos (ej. DATE, VARCHAR(255), INT, etc.)
tablaYesNombre de la tabla

Implementation Reference

  • mcp_server.js:504-534 (registration)
    Full registration of the 'cambiarTipoColumna' tool including description, schema, and inline handler function.
    server.tool(
      'cambiarTipoColumna',
      'Sigue estas reglas OBLIGATORIAS para cambiar el tipo de una columna:\n'
      + 'ADVERTENCIA INICIAL: Informa al usuario que cambiar el tipo de dato de una columna es una acción PELIGROSA que puede resultar en PÉRDIDA DE DATOS si la conversión no es compatible.\n'
      + 'CONFIRMACIÓN EXPLÍCITA: Para proceder, el usuario DEBE escribir la frase exacta: "Confirmar cambio de tipo para la columna [nombreColumna] a [nuevoTipo]".\n'
      + 'VERIFICACIÓN ESTRICTA: No ejecutes la modificación si la confirmación no es exacta.\n'
      + 'USO: Especifica la tabla, la columna y el nuevo tipo de dato.\n'
      + 'EJEMPLO: "Cambia el tipo de la columna fecha a DATE en la tabla ventas."',
      {
        tabla: z.string().describe('Nombre de la tabla'),
        columna: z.string().describe('Nombre de la columna a modificar'),
        nuevoTipo: z.string().describe('Nuevo tipo de datos (ej. DATE, VARCHAR(255), INT, etc.)'),
      },
      async ({ tabla, columna, nuevoTipo }) => {
        try {
          if (!tabla || !columna || !nuevoTipo) {
            return { isError: true, content: [{ type: 'text', text: 'Debes proporcionar la tabla, columna y el nuevo tipo.' }] };
          }
          let sql;
          if (db_type === 'mysql') {
            sql = `ALTER TABLE ${quoteIdent(tabla)} MODIFY COLUMN ${quoteIdent(columna)} ${nuevoTipo}`;
          } else {
            sql = `ALTER TABLE ${quoteIdent(tabla)} ALTER COLUMN ${quoteIdent(columna)} TYPE ${nuevoTipo}`;
          }
          await query_runner.runQuery(sql);
          return { content: [{ type: 'text', text: `Tipo de columna '${columna}' cambiado a '${nuevoTipo}' exitosamente.` }] };
        } catch (e) {
          return { isError: true, content: [{ type: 'text', text: 'Error al cambiar tipo de columna: ' + (e.message || e) }] };
        }
      }
    );
  • Handler function that validates inputs, constructs database-specific ALTER TABLE SQL to modify column type, executes via query_runner, and returns success/error response.
      async ({ tabla, columna, nuevoTipo }) => {
        try {
          if (!tabla || !columna || !nuevoTipo) {
            return { isError: true, content: [{ type: 'text', text: 'Debes proporcionar la tabla, columna y el nuevo tipo.' }] };
          }
          let sql;
          if (db_type === 'mysql') {
            sql = `ALTER TABLE ${quoteIdent(tabla)} MODIFY COLUMN ${quoteIdent(columna)} ${nuevoTipo}`;
          } else {
            sql = `ALTER TABLE ${quoteIdent(tabla)} ALTER COLUMN ${quoteIdent(columna)} TYPE ${nuevoTipo}`;
          }
          await query_runner.runQuery(sql);
          return { content: [{ type: 'text', text: `Tipo de columna '${columna}' cambiado a '${nuevoTipo}' exitosamente.` }] };
        } catch (e) {
          return { isError: true, content: [{ type: 'text', text: 'Error al cambiar tipo de columna: ' + (e.message || e) }] };
        }
      }
    );
  • Zod schema defining input parameters for the tool: tabla (string), columna (string), nuevoTipo (string).
    {
      tabla: z.string().describe('Nombre de la tabla'),
      columna: z.string().describe('Nombre de la columna a modificar'),
      nuevoTipo: z.string().describe('Nuevo tipo de datos (ej. DATE, VARCHAR(255), INT, etc.)'),
    },
Behavior4/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 discloses critical behavioral traits: the action is 'PELIGROSA' (dangerous) with potential 'PÉRDIDA DE DATOS' (data loss), requires explicit user confirmation with a specific phrase, and includes strict verification rules. However, it lacks details on error handling, rollback capabilities, or performance impact, which are relevant for a destructive operation.

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 bullet-point-like rules (ADVERTENCIA, CONFIRMACIÓN, VERIFICACIÓN, USO, EJEMPLO), which aids readability. However, it is verbose for a simple tool—the warning and confirmation rules could be condensed. Every sentence earns its place by providing necessary safety instructions, but it could be more front-loaded with the core purpose.

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?

Given the tool's complexity (a destructive database operation with no annotations and no output schema), the description is fairly complete. It covers the purpose, usage, safety warnings, and confirmation requirements. However, it lacks information on return values or error responses, which would be helpful for an agent. The context is sufficient for safe use but not fully comprehensive.

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 description coverage is 100%, with clear descriptions for 'columna', 'nuevoTipo', and 'tabla'. The description adds minimal value beyond the schema: it reiterates the need to specify these parameters in the 'USO' section and provides an example. Since the schema already documents parameters well, the baseline score of 3 is appropriate, as the description doesn't add significant semantic context.

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 the tool's purpose: 'cambiar el tipo de una columna' (change the type of a column). It specifies the verb ('cambiar') and resource ('tipo de una columna'), and clearly distinguishes it from sibling tools like 'renombrarColumna' (rename column) or 'agregarColumna' (add column), which perform different operations on columns.

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 guidelines: it states 'USO: Especifica la tabla, la columna y el nuevo tipo de dato' (USE: Specify the table, column, and new data type) and includes an example. It also implicitly distinguishes from alternatives by focusing on type changes, unlike other tools for adding, deleting, or renaming columns. The warning and confirmation rules further clarify when to use it cautiously.

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