Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dbml.db",
"version": "0.3.0",
"version": "0.3.1",
"private": true,
"description": "DBML as a service for AI agents: validate, parse, review and convert database schemas over an HTTP API, MCP server and CLI.",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Inputs up to ${MAX_INPUT_BYTES / 1024} KiB. ${process.env.RATE_LIMIT_PER_MIN ||
A plain-words answer to a database question, grounded in the engine's exact findings and SQL. ${process.env.ASK_PRICE_CENTS || 5} cents per answer from a prepaid balance; failures are free.
Token: get a personal link at ${SITE}ask (token = the part after /ask/), top up there. Send "Authorization: Bearer <token>".
- POST /api/ask {question, schema?} -> 202 {id}; GET /api/ask/<id> -> {status: working|answered|failed, answer, error}
- MCP: ask_dba {question, schema?, wait_seconds?}, ask_dba_result {id} (same Bearer header on /mcp)
- MCP: ask_dba {question, schema?, wait_seconds? (max 12)} -> {id, status}; poll ask_dba_result {id} every 5-10 s (answers take 30-90 s). Same Bearer header on /mcp.

## Review rules
${RULES.map((r) => `- ${r.id} (${r.severity}): ${r.description}`).join('\n')}
Expand Down
4 changes: 2 additions & 2 deletions src/mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ export function buildMcpServer({ token = null } = {}) {
}, run(() => SYNTAX));

server.registerTool('ask_dba', {
description: `Ask the DBA agent a database question about a schema (DBML or SQL DDL): what is wrong, how to index, how to migrate, SQL for a dialect. The answer is written by an AI model given the review engine's exact findings and SQL, with that exact output appended. Paid: ${PRICE_CENTS()} cents per answer from the token's prepaid balance; failures are free. Waits up to wait_seconds, then returns status "working" and an id for ask_dba_result.`,
description: `Ask the DBA agent a database question about a schema (DBML or SQL DDL): what is wrong, how to index, how to migrate, SQL for a dialect. The answer is written by an AI model given the review engine's exact findings and SQL, with that exact output appended. Paid: ${PRICE_CENTS()} cents per answer from the token's prepaid balance; failures are free. An answer usually takes 30-90 s: this returns within wait_seconds (max 12, the gateway closes longer requests) with status "working" and an id; call ask_dba_result with that id every 5-10 s until status is "answered" or "failed".`,
inputSchema: {
question: z.string().describe('The question, in plain words'),
schema: z.string().optional().describe('DBML or SQL CREATE TABLE statements'),
wait_seconds: z.number().int().min(0).max(170).default(150).describe('How long to wait for the answer'),
wait_seconds: z.number().int().min(0).max(12).default(10).describe('How long to wait before returning (max 12)'),
},
}, async ({ question, schema, wait_seconds: wait }) => {
const account = accountByToken(token);
Expand Down
2 changes: 1 addition & 1 deletion src/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ ${endpoint('GET', '/api/v1/syntax', '', 'DBML cheat sheet (text)')}
<pre>curl -s ${h(SITE)}api/ask -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \\
-d '{"question":"What would you index?","schema":"Table users { id int [pk] }"}' # {id}
curl -s ${h(SITE)}api/ask/$ID -H "authorization: Bearer $TOKEN" # {status, answer}</pre>
<p>Over MCP: send the same <code>Authorization: Bearer</code> header on the connection and call <code>ask_dba</code> (waits for the answer) or <code>ask_dba_result</code>.</p>
<p>Over MCP: send the same <code>Authorization: Bearer</code> header on the connection and call <code>ask_dba</code> (returns an id within 12 s), then <code>ask_dba_result</code> every 5-10 s until the answer is in (usually 30-90 s).</p>
<pre>claude mcp add --transport http dbml ${h(SITE)}mcp --header "Authorization: Bearer $TOKEN"</pre>

<h2 id="mcp">MCP server</h2>
Expand Down
Loading