MCP Reference
MCP Reference
Section titled “MCP Reference”dbward exposes 12 tools, 3 fixed resources, 3 resource templates, and 6 prompts via the Model Context Protocol (MCP). Start the MCP server with dbward mcp.
For setup instructions, see MCP Integration.
Tools (12)
Section titled “Tools (12)”dbward_execute_query
Section titled “dbward_execute_query”Execute a SQL query through the approval workflow.
| Parameter | Type | Required | Description |
|---|---|---|---|
sql | string | ✓ | SQL statement to execute |
database | string | Target database name | |
environment | string | Environment (development/staging/production) | |
reason | string | Reason for execution (required by some workflows) |
Returns: Query result (rows) or approval status. If approval is needed, uses elicitation to wait.
dbward_migrate_status
Section titled “dbward_migrate_status”Show migration status (applied/pending).
| Parameter | Type | Required | Description |
|---|---|---|---|
database | string | Target database name | |
environment | string | Environment |
dbward_migrate_up
Section titled “dbward_migrate_up”Apply pending database migrations.
| Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | Max migrations to apply (default: all) | |
database | string | Target database name | |
environment | string | Environment |
dbward_migrate_down
Section titled “dbward_migrate_down”Rollback database migrations.
| Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | Migrations to rollback (default: 1) | |
database | string | Target database name | |
environment | string | Environment |
dbward_migrate_create
Section titled “dbward_migrate_create”Create a new migration file locally (no server needed).
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | ✓ | Migration name (e.g., create_users) |
Returns: Path to created file with up/down template.
dbward_wait_request
Section titled “dbward_wait_request”Check request status or wait for completion.
| Parameter | Type | Required | Description |
|---|---|---|---|
request_id | string | ✓ | Request ID |
timeout | integer | Max wait seconds (default: 60) | |
include_result | boolean | If true (default), resume and return result. If false, status only. |
dbward_list_pending
Section titled “dbward_list_pending”List requests pending approval. No parameters.
dbward_who_can_approve
Section titled “dbward_who_can_approve”Show who can approve a specific request.
| Parameter | Type | Required | Description |
|---|---|---|---|
request_id | string | ✓ | Request ID |
Returns: Roles, groups, and step information for approvers.
dbward_find_similar_requests
Section titled “dbward_find_similar_requests”Find past requests similar to the given SQL or operation.
| Parameter | Type | Required | Description |
|---|---|---|---|
sql | string | SQL to match against | |
operation | string | Operation type filter | |
limit | integer | Max results (default: 5) |
dbward_preflight_sql
Section titled “dbward_preflight_sql”Analyze a SQL statement without creating a request. Returns classification, risk assessment, policy simulation, review findings, fix hints, and optionally EXPLAIN output.
| Parameter | Type | Required | Description |
|---|---|---|---|
sql | string | ✓ | SQL statement to analyze |
database | string | Target database name | |
environment | string | Environment | |
include_explain | boolean | Run EXPLAIN via agent (default: true) | |
explain_timeout_ms | integer | Max EXPLAIN wait in ms (default: 5000) |
Returns: Full preflight analysis result including status (requestable/blocked/warning), risk, classification, review, risk_assessment, policy, impact, fix_hints, retryable, and next_actions.
dbward_explain_policy_failure
Section titled “dbward_explain_policy_failure”Explain why a request was blocked or requires approval.
| Parameter | Type | Required | Description |
|---|---|---|---|
request_id | string | Existing request ID | |
operation | string | Operation type | |
environment | string | Environment | |
database | string | Database name |
Provide either request_id (for an existing request) or operation + environment + database (for hypothetical check).
dbward_inspect_schema
Section titled “dbward_inspect_schema”Inspect database schema.
| Parameter | Type | Required | Description |
|---|---|---|---|
table | string | Table name (omit to list all tables) | |
database | string | Target database name |
Resources (3 fixed)
Section titled “Resources (3 fixed)”| URI | Name | Description |
|---|---|---|
dbward://migrations/status | Migration Status | Applied and pending migrations |
dbward://requests/pending | Pending Requests | Requests awaiting approval |
dbward://audit/recent | Recent Audit Events | Last 10 audit events |
Resource Templates (3)
Section titled “Resource Templates (3)”| URI Template | Name | Description |
|---|---|---|
dbward://requests/{request_id} | Request Details | Details for a specific request |
dbward://schema/{database} | Database Schema | Table list with row counts |
dbward://schema/{database}/{table} | Table Schema | Column, constraint, and index details |
Prompts (6)
Section titled “Prompts (6)”review_migration
Section titled “review_migration”Review a migration SQL file for safety issues (locking, data loss, backwards compatibility).
| Argument | Required | Description |
|---|---|---|
file_path | ✓ | Path to migration file |
explain_request
Section titled “explain_request”Explain what a request will do and its impact.
| Argument | Required | Description |
|---|---|---|
request_id | ✓ | Request ID |
draft_migration
Section titled “draft_migration”Generate migration SQL from a natural language description.
| Argument | Required | Description |
|---|---|---|
description | ✓ | What the migration should do |
draft_rollback
Section titled “draft_rollback”Generate rollback SQL for an existing migration.
| Argument | Required | Description |
|---|---|---|
migration_file | ✓ | Path to migration file to rollback |
summarize_audit_trail
Section titled “summarize_audit_trail”Summarize recent audit events.
| Argument | Required | Description |
|---|---|---|
since | Start date (ISO 8601) | |
database | Filter by database |
prepare_approval_comment
Section titled “prepare_approval_comment”Draft an approval comment for a request.
| Argument | Required | Description |
|---|---|---|
request_id | ✓ | Request ID to review |
Environment resolution
Section titled “Environment resolution”Tools that need environment resolve it in this order:
environmentparameter in the tool callDBWARD_ENVenvironment variabledefault_environmentin CLI config
If none is set, tools that require environment return an error.
See also
Section titled “See also”- MCP Integration Guide — IDE setup (stdio and remote), usage examples
- Executing Queries — the approval flow
Transport
Section titled “Transport”dbward MCP is available over two transports:
| Transport | Endpoint | Tools | Prompts | Use case |
|---|---|---|---|---|
| stdio | dbward mcp (local process) | 12 | 6 | Individual requester, IDE-native |
| Remote HTTP | POST /mcp on the server | 9 | 4 | Team setup, no local binary needed |
Remote HTTP excludes tools/prompts that require local filesystem access (migrate_up, migrate_down, migrate_create, review_migration, draft_rollback). Authentication uses the same token or OIDC as the REST API.
For IDE-specific setup instructions and configuration examples, see the MCP Integration Guide.