Skip to main content
Glama
nilsir

MCP Server MySQL

by nilsir

create_database

Create a new MySQL database with configurable character set and collation settings for organizing and storing data.

Instructions

Create a new database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name
charsetNoCharacter set (default: utf8mb4)
collationNoCollation (default: utf8mb4_unicode_ci)

Implementation Reference

  • The handler function for the 'create_database' tool. It creates a new MySQL database using the provided name, charset, and collation, then returns a success response with structured output.
    async ({ database, charset, collation }) => {
      const p = await getPool();
      const cs = charset || "utf8mb4";
      const col = collation || "utf8mb4_unicode_ci";
    
      await p.execute(
        `CREATE DATABASE \`${database}\` CHARACTER SET ${cs} COLLATE ${col}`
      );
    
      const output = { success: true, database, charset: cs, collation: col };
    
      return {
        content: [
          {
            type: "text" as const,
            text: `Database ${database} created successfully`,
          },
        ],
        structuredContent: output,
      };
    }
  • The input schema (Zod) for the 'create_database' tool defining parameters: database (required string), charset and collation (optional strings).
    {
      database: z.string().describe("Database name"),
      charset: z.string().optional().describe("Character set (default: utf8mb4)"),
      collation: z.string().optional().describe("Collation (default: utf8mb4_unicode_ci)"),
    },
  • src/index.ts:437-466 (registration)
    The registration of the 'create_database' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "create_database",
      "Create a new database",
      {
        database: z.string().describe("Database name"),
        charset: z.string().optional().describe("Character set (default: utf8mb4)"),
        collation: z.string().optional().describe("Collation (default: utf8mb4_unicode_ci)"),
      },
      async ({ database, charset, collation }) => {
        const p = await getPool();
        const cs = charset || "utf8mb4";
        const col = collation || "utf8mb4_unicode_ci";
    
        await p.execute(
          `CREATE DATABASE \`${database}\` CHARACTER SET ${cs} COLLATE ${col}`
        );
    
        const output = { success: true, database, charset: cs, collation: col };
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Database ${database} created successfully`,
            },
          ],
          structuredContent: output,
        };
      }
    );
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. 'Create a new database' implies a write operation, but it doesn't mention permissions required, whether the operation is idempotent, potential side effects, or what happens on success/failure. This leaves significant gaps for a mutation tool.

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 extremely concise at three words, front-loading the core purpose without any wasted text. Every word earns its place, making it efficient and easy to parse.

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

Completeness2/5

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

Given the complexity of a database creation tool (a mutation with no annotations and no output schema), the description is insufficient. It doesn't address behavioral aspects like permissions, idempotency, or error handling, nor does it explain what the tool returns, leaving the agent with critical gaps.

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 description adds no parameter semantics beyond what the input schema provides. With 100% schema description coverage, the schema already documents all three parameters (database, charset, collation) with their types and defaults. The baseline score of 3 reflects adequate coverage from the schema alone.

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

Purpose4/5

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

The description 'Create a new database' clearly states the action (create) and resource (database), making the purpose immediately understandable. However, it doesn't distinguish this tool from similar siblings like 'create_table' or 'create_index' which also create resources, so it lacks differentiation.

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 provides no guidance on when to use this tool versus alternatives. There are no indications of prerequisites (e.g., needing to connect first), exclusions (e.g., not for modifying existing databases), or comparisons to siblings like 'alter_table' or 'drop_database' for related operations.

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/nilsir/mcp-server-mysql'

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