Skip to main content
Glama
Yonsn76

MyPos MCP

by Yonsn76

columnasDeTabla

Retrieve all column names from a specific database table to understand its structure before querying or inserting data.

Instructions

Sigue estas reglas para listar columnas: PROPÓSITO: Obtener una lista con los nombres de todas las columnas de una tabla específica. USO: Útil para conocer la estructura de una tabla antes de realizar una consulta o inserción. EJEMPLO: "¿Cuáles son las columnas de la tabla ventas?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tablaYesNombre de la tabla

Implementation Reference

  • mcp_server.js:82-106 (registration)
    Registration of the 'columnasDeTabla' tool, including input schema, description, and handler function that fetches and formats table columns.
    server.tool(
      'columnasDeTabla',
      'Sigue estas reglas para listar columnas:\n'
      + 'PROPÓSITO: Obtener una lista con los nombres de todas las columnas de una tabla específica.\n'
      + 'USO: Útil para conocer la estructura de una tabla antes de realizar una consulta o inserción.\n'
      + 'EJEMPLO: "¿Cuáles son las columnas de la tabla ventas?"',
      {
        tabla: z.string().describe('Nombre de la tabla'),
      },
      async ({ tabla }) => {
        try {
          const columns = await query_runner.getTableColumns(tabla);
          if (!columns || columns.length === 0) {
            return { content: [{ type: 'text', text: `La tabla '${tabla}' no tiene columnas.` }] };
          }
          return {
            content: [
              { type: 'text', text: `Columnas de la tabla '${tabla}':\n` + columns.map(col => `- ${col}`).join('\n') }
            ]
          };
        } catch (e) {
          return { isError: true, content: [{ type: 'text', text: 'Error al listar columnas: ' + (e.message || e) }] };
        }
      }
    );
  • The main handler logic for executing the tool, which calls getTableColumns and formats the response.
    async ({ tabla }) => {
      try {
        const columns = await query_runner.getTableColumns(tabla);
        if (!columns || columns.length === 0) {
          return { content: [{ type: 'text', text: `La tabla '${tabla}' no tiene columnas.` }] };
        }
        return {
          content: [
            { type: 'text', text: `Columnas de la tabla '${tabla}':\n` + columns.map(col => `- ${col}`).join('\n') }
          ]
        };
      } catch (e) {
        return { isError: true, content: [{ type: 'text', text: 'Error al listar columnas: ' + (e.message || e) }] };
      }
    }
  • Input schema validation using Zod for the 'tabla' parameter.
    {
      tabla: z.string().describe('Nombre de la tabla'),
    },
  • Supporting method in QueryRunner class that retrieves column names for a given table, used by the tool handler. Supports MySQL and PostgreSQL.
    async getTableColumns(table) {
      try {
        if (this.db_type === 'mysql') {
          const [cols] = await this.pool.execute(`SHOW COLUMNS FROM \`${table}\``);
          return cols.map(c => c.Field);
        } else { // pg
          const res = await this.pool.query(`
            SELECT column_name FROM information_schema.columns
            WHERE table_name = $1
          `, [table]);
          return res.rows.map(c => c.column_name);
        }
      } catch (error) {
        // Si la tabla no existe, retornamos un array vacío
        return [];
      }
    }
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 of behavioral disclosure. While it states the tool lists column names, it doesn't describe the return format (e.g., list of strings, JSON structure), whether it includes metadata like data types, error handling for non-existent tables, or any performance considerations. For a read operation with zero annotation coverage, this leaves significant gaps.

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 well-structured with labeled sections (PROPÓSITO, USO, EJEMPLO) and uses three concise sentences that each add value. It's front-loaded with the purpose and avoids unnecessary repetition or fluff.

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 tool's low complexity (single parameter, read-only operation) and 100% schema coverage, the description is adequate but not complete. It lacks details on output format and error behavior, which are important for an agent to use it correctly. No output schema exists, so the description should ideally cover return values, but it doesn't.

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 (the 'tabla' parameter is described as 'Nombre de la tabla'), so the schema already documents the parameter. The description doesn't add any additional meaning or examples beyond what the schema provides, such as format requirements or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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 purpose as 'Obtener una lista con los nombres de todas las columnas de una tabla específica' (Get a list with the names of all columns of a specific table). This is a specific verb+resource combination that clearly distinguishes it from sibling tools like listarTablas (list tables) or consultarSQL (query SQL).

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'Útil para conocer la estructura de una tabla antes de realizar una consulta o inserción' (Useful for knowing the structure of a table before performing a query or insertion). It doesn't explicitly state when not to use it or name specific alternatives, but the context is well-defined and helpful.

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