analyze_table
Collect and analyze statistics for specified tables in Amazon Redshift to optimize database performance and query execution efficiency.
Instructions
Analyze table to collect statistics information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | Schema name | |
| table | Yes | Table name |
Implementation Reference
- Handles input validation for schema and table parameters and constructs the ANALYZE SQL statement.elif name == "analyze_table": schema = args.get("schema") table = args.get("table") if not all([schema, table]): raise ValueError("'schema' and 'table' parameters are required when calling analyze_table tool") sql = f"ANALYZE {schema}.{table}"
- Returns a success message specific to the analyze_table tool after SQL execution, bypassing result fetching.if name == "analyze_table": return [TextContent(type="text", text=f"Successfully analyzed table {schema}.{table}")]
- src/redshift_mcp_server/server.py:139-156 (registration)Registers the analyze_table tool with the MCP server, including description and input schema.Tool( name="analyze_table", description="Analyze table to collect statistics information", inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name" }, "table": { "type": "string", "description": "Table name" } }, "required": ["schema", "table"] } ),
- Defines the input schema for the analyze_table tool, specifying required schema and table parameters.inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name" }, "table": { "type": "string", "description": "Table name" } }, "required": ["schema", "table"] }