get_table_schema
Extract the schema and column definitions of a specified table from a MariaDB database using the MariaDB Reader MCP Server for efficient database exploration and analysis.
Instructions
특정 테이블의 스키마(컬럼 정의)를 가져옵니다.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | 데이터베이스의 이름입니다. | |
| table | Yes | 테이블의 이름입니다. |
Input Schema (JSON Schema)
{
"properties": {
"database": {
"description": "데이터베이스의 이름입니다.",
"type": "string"
},
"table": {
"description": "테이블의 이름입니다.",
"type": "string"
}
},
"required": [
"database",
"table"
],
"type": "object"
}
Implementation Reference
- src/index.ts:146-155 (handler)Executes the get_table_schema tool: extracts database and table names, validates parameters, creates DB connection, runs DESCRIBE query to fetch schema, and returns JSON-formatted result.case "get_table_schema": { const dbName = args.database as string; // 데이터베이스 이름 추출 const tableName = args.table as string; // 테이블 이름 추출 if (!dbName) throw new McpError(ErrorCode.InvalidParams, "필수 파라미터 누락: database"); if (!tableName) throw new McpError(ErrorCode.InvalidParams, "필수 파라미터 누락: table"); connection = await createDbConnection(dbName); // 지정된 DB로 연결 // 테이블 스키마 조회 쿼리 (예약어 또는 특수문자 가능성을 위해 백틱 사용) const [rows] = await connection.query(`DESCRIBE \`${tableName}\`;`); return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] }; }
- src/index.ts:94-101 (schema)Input schema for get_table_schema: requires 'database' and 'table' strings.inputSchema: { type: "object", properties: { database: { type: "string", description: "데이터베이스의 이름입니다." }, table: { type: "string", description: "테이블의 이름입니다." } }, required: ["database", "table"] }
- src/index.ts:91-102 (registration)Tool registration in list_tools handler: defines name, description, and input schema for get_table_schema.{ name: "get_table_schema", description: "특정 테이블의 스키마(컬럼 정의)를 가져옵니다.", inputSchema: { type: "object", properties: { database: { type: "string", description: "데이터베이스의 이름입니다." }, table: { type: "string", description: "테이블의 이름입니다." } }, required: ["database", "table"] } },