Skip to main content

Database Tools Reference

The MCP Database Server provides a set of tools that Claude can use to interact with your databases. This page describes each tool, its parameters, and how to use it effectively.

Available Tools

ToolDescriptionRequired Parameters
read_queryExecute SELECT queries to read dataquery: SQL SELECT statement
write_queryExecute INSERT, UPDATE, or DELETE queriesquery: SQL modification statement
create_tableCreate new tables in the databasequery: CREATE TABLE statement
alter_tableModify existing table schemaquery: ALTER TABLE statement
drop_tableRemove a table from the databasetable_name: Name of table
confirm: Safety flag (must be true)
list_tablesGet a list of all tablesNone
describe_tableView schema information for a tabletable_name: Name of table
export_queryExport query results as CSV/JSONquery: SQL SELECT statement
format: "csv" or "json"
append_insightAdd a business insight to memoinsight: Text of insight
list_insightsList all business insightsNone

Tool Usage Examples

Reading Data

To retrieve data from the database:

What customers have spent more than $1000 in the past month?

Claude will use the read_query tool with an appropriate SQL query.

Writing Data

To insert, update, or delete data:

Add a new product called "Deluxe Widget" with price $29.99 to the Products table.

Claude will use the write_query tool to perform the INSERT operation.

Schema Management

To create or modify tables:

Create a new table called "CustomerFeedback" with columns for customer ID, rating (1-5), and comment text.

Claude will use the create_table tool to define the new table.

Exporting Data

To export query results:

Export all sales from the last quarter as CSV.

Claude will use the export_query tool with the format parameter set to "csv".

Working with Insights

Claude can track important observations during your database analysis:

Add an insight that "Sales are 15% higher on weekends compared to weekdays"

Claude will use the append_insight tool to record this information.

Best Practices

  1. Be specific in your requests: Provide clear details about what data you want to retrieve or modify.

  2. Use natural language: Ask questions as you would to a human analyst. Claude will convert your request into appropriate SQL.

  3. Review before committing: For data modifications, always review what Claude proposes before confirming.

  4. Consider data volume: For large tables, use filtering to limit result sets.

  5. Think about performance: Complex queries on large tables might take time to execute.

Limitations

  1. The server does not support certain database-specific features like stored procedures or triggers.

  2. For security reasons, file operations and system commands are not available.

  3. There may be slight syntax differences between SQLite, SQL Server, and PostgreSQL. Claude will attempt to adapt queries accordingly.

  4. Large result sets might be truncated to prevent memory issues.