Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_create_table

Create tables in MySQL databases using SQL statements. This tool enables structured data storage by defining table schemas with columns, data types, and constraints.

Instructions

创建表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes创建表的 SQL 语句

Implementation Reference

  • The main handler function for the 'mysql_create_table' tool. It receives the SQL from arguments and delegates to DatabaseManager.createTable to execute it, then returns a success message.
    private async handleCreateTable(args: { sql: string }): Promise<any> { await this.dbManager.createTable(args.sql); return { content: [ { type: 'text', text: '成功创建表', }, ], }; }
  • Input schema definition for the mysql_create_table tool, specifying that it requires a 'sql' string parameter.
    inputSchema: { type: 'object', properties: { sql: { type: 'string', description: '创建表的 SQL 语句' }, }, required: ['sql'], },
  • src/server.ts:247-248 (registration)
    Registration in the CallToolRequestSchema switch statement that routes calls to mysql_create_table to the handleCreateTable method.
    case 'mysql_create_table': return await this.handleCreateTable(args as any);
  • src/server.ts:117-127 (registration)
    Tool registration in the ListToolsRequestSchema response, defining the tool's name, description, and input schema.
    { name: 'mysql_create_table', description: '创建表', inputSchema: { type: 'object', properties: { sql: { type: 'string', description: '创建表的 SQL 语句' }, }, required: ['sql'], }, },
  • Helper method in DatabaseManager that executes the provided CREATE TABLE SQL using the query method.
    async createTable(sql: string): Promise<void> { await this.query(sql); }

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/pickstar-2002/mysql-mcp'

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