Skip to main content
Glama
chenkumi

easy-mysql-mcp

by chenkumi

list_views

Retrieve the list of all views in the current MySQL database for schema discovery and analysis.

Instructions

List all views in the current database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:83-99 (registration)
    Registration of the 'list_views' tool. Uses server.registerTool with a name of 'list_views', a Zod schema with no inputs, and an async handler that queries information_schema.VIEWS to list all views in the current database.
    server.registerTool(
      'list_views',
      {
        description: 'List all views in the current database.',
        inputSchema: z.object({}),
      },
      async () => {
        const results = await db.query(`
          SELECT TABLE_NAME, VIEW_DEFINITION 
          FROM information_schema.VIEWS 
          WHERE TABLE_SCHEMA = DATABASE()
        `);
        return {
          content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
        };
      }
    );
  • The actual handler function for the 'list_views' tool. It queries information_schema.VIEWS for TABLE_NAME and VIEW_DEFINITION filtered by the current database schema, then returns the results as JSON text.
    async () => {
      const results = await db.query(`
        SELECT TABLE_NAME, VIEW_DEFINITION 
        FROM information_schema.VIEWS 
        WHERE TABLE_SCHEMA = DATABASE()
      `);
      return {
        content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
      };
    }
  • Input schema for the 'list_views' tool. Defined as z.object({}) — no input parameters required.
      inputSchema: z.object({}),
    },
  • The query helper function used by the list_views handler to execute SQL queries against the MySQL database.
    export async function query(sql: string, params?: any[]) {
      const [rows] = await pool.query(sql, params);
      return rows;
    }
Behavior2/5

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

No annotations provided, so the description must fully disclose behavior. It only states 'List all views' without specifying that it is read-only, whether results are ordered, paginated, or what form the list takes. Minimal transparency for a potentially resource-consuming operation.

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?

Single, clear sentence with no extraneous words. Perfectly concise and structured for quick comprehension.

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 no output schema, the description should indicate what the list contains (e.g., names only). It does not, leaving ambiguity. However, for a straightforward listing tool with zero parameters, the description is minimally adequate but could be more 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?

Zero parameters and schema coverage is 100% (vacuously). Per calibration, 0 parameters gives baseline 4. The description adds no parameter info, but none is needed.

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?

Clearly states the verb 'List' and resource 'views' with scope 'all views in the current database'. Differentiated from siblings that focus on tables, indexes, queries, etc.

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

Usage Guidelines3/5

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

No explicit guidance on when to use versus alternatives, though the sibling tools cover different database objects, making usage contextually implied. Lacks any 'when not to use' or alternative references.

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/chenkumi/easy-mysql-mcp'

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