ask_docs_question
Ask a question about DuckDB or MotherDuck and get answers from official documentation.
Description
The ask_docs_question tool queries the official DuckDB and MotherDuck documentation to answer questions about SQL syntax, features, best practices, and more. This is useful when you need help with DuckDB-specific SQL syntax or MotherDuck features.
The tool uses MotherDuck's documentation assistant to provide accurate answers based on official documentation sources.
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
question | string | Yes | Question about DuckDB or MotherDuck |
Output Schema
{
"success": boolean,
"question": string, // Original question (on success)
"answer": string, // Documentation-based answer (on success)
"sources": string, // Source references (optional, on success)
"error": string // Error message (on failure)
}
Example Usage
Ask about DuckDB syntax:
How do I use window functions in DuckDB?
The AI assistant will call the tool with:
{
"question": "How do I use window functions in DuckDB?"
}
Ask about MotherDuck features:
How do I create a share in MotherDuck?
{
"question": "How do I create a share in MotherDuck?"
}
Ask about data types:
What's the difference between LIST and ARRAY types in DuckDB?
{
"question": "What's the difference between LIST and ARRAY types in DuckDB?"
}
Success Response Example
{
"success": true,
"question": "How do I use window functions in DuckDB?",
"answer": "Window functions in DuckDB allow you to perform calculations across a set of rows related to the current row. Here's how to use them:\n\n**Basic syntax:**\n```sql\nSELECT \n column,\n SUM(value) OVER (PARTITION BY category ORDER BY date) as running_total\nFROM table_name;\n```\n\n**Common window functions:**\n- `ROW_NUMBER()` - assigns unique row numbers\n- `RANK()` and `DENSE_RANK()` - ranking with/without gaps\n- `LAG()` and `LEAD()` - access previous/next rows\n- `FIRST_VALUE()` and `LAST_VALUE()` - first/last value in window\n\n**Using QUALIFY:**\nDuckDB supports the QUALIFY clause to filter window function results:\n```sql\nSELECT *\nFROM sales\nQUALIFY ROW_NUMBER() OVER (PARTITION BY region ORDER BY amount DESC) = 1;\n```\n\nThis returns only the top sale per region.",
"sources": "https://duckdb.org/docs/sql/window_functions"
}
Tips for Good Questions
- Be specific about what you want to know
- Include context about what you're trying to accomplish
- Mention specific functions or features if known