redshift_get_sample_data
Retrieve sample rows from a Redshift table to preview data structure and content before querying.
Instructions
Get sample rows from a table.
Args:
table_name: Name of the table
limit: Number of rows to return (default: 5)
schema: Schema name (default: "public")
Returns:
JSON sample data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | ||
| limit | No | ||
| schema | No | public |
Implementation Reference
- redshift_mcp_server.py:117-131 (handler)The main handler function for the 'redshift_get_sample_data' tool. It is decorated with @mcp.tool() which serves as both the implementation and registration in FastMCP. The function generates a SQL query to fetch a limited number of rows from the specified table and delegates execution to the 'redshift_query' tool, returning JSON results.@mcp.tool() def redshift_get_sample_data(table_name: str, limit: int = 5, schema: str = "public") -> str: """ Get sample rows from a table. Args: table_name: Name of the table limit: Number of rows to return (default: 5) schema: Schema name (default: "public") Returns: JSON sample data """ sql = f"SELECT * FROM {schema}.{table_name} LIMIT {limit}" return redshift_query(sql)