Skip to main content
Glama
ostermeyer

jmd-mcp-sql

by ostermeyer

write

Insert or replace database records and define SQLite DDL objects—tables, indexes, triggers, views—using JMD text documents.

Instructions

Write a record or define a DDL object (https://github.com/ostermeyer/jmd-spec).

Data (# Label): INSERT OR REPLACE one record.

# Order
id: 42
status: shipped
total: 149.99

Bulk insert (# Label[]):

# Order[]
- id: 42
  status: shipped
- id: 43
  status: pending

Schema (#! Label): full SQLite DDL surface.

Per-column types: integer, float, string, boolean (int in SQLite). Per-column modifiers: readonly primary key (single-col); do not supply on insert optional NULL allowed = DEFAULT value (number, string, CURRENT_TIMESTAMP) a|b|c enum form — generates a CHECK (col IN (…))

#! Order
id: integer readonly
status: pending|shipped|cancelled
total: float = 0
customer_id: integer

Table-level constraints as sub-sections:

primary-key[] composite PK (column names)

unique[] UNIQUE constraints (each entry one or more cols)

check[] raw CHECK expressions

references[] single-col FKs in form 'local: Table.foreign'

Inline DDL objects under #! Table (created atomically with the table):

Index[] name, columns, optional unique / where

Trigger[] name, when, event, body, optional condition

Top-level DDL-object documents:

#! Index
name: idx_order_status
table: Order
columns: status
unique: false
where: deleted_at IS NULL

#! Trigger
name: trg_log_orders
table: Order
when: AFTER          # BEFORE | AFTER | INSTEAD OF
event: INSERT        # INSERT | UPDATE [OF cols] | DELETE
condition: NEW.status = 'pending'
body: "INSERT INTO Log(msg) VALUES ('x');"

#! View
name: PendingOrders
select: "SELECT id FROM \\\"Order\\\" WHERE status='pending'"

Virtual tables — using: <module> modifier on #! Table:

#! Notes
using: fts5
title: string
body: string
## unindexed[]
- memory_id
## options[]
- "tokenize = 'porter unicode61'"

Existing tables: writes are additive — only new columns are added. Constraint or column-type changes need 'action: rebuild' frontmatter, which runs the SQLite table-rebuild dance atomically (data preserved over the column intersection; pre-existing dependent indexes and triggers must be redeclared inline in the rebuild document).

Frontmatter policy: observable tolerance. Frontmatter keys: action (= 'rebuild'), debug. Debug: 'debug: sql, timing, table'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.11.0

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations to rely on, the description fully discloses behavior: INSERT OR REPLACE semantics, bulk insert support, atomic creation of inline DDL objects, additive writes for existing tables, the rebuild dance, and debug frontmatter. This is far beyond minimal behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but every section adds necessary DSL detail and examples. It is front-loaded with the purpose and then organized by document form; the length is justified by the complexity of the format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the single untyped string parameter and no annotations, the description is essentially complete as a usage manual. It covers all supported syntax, edge cases like additive schema changes, rebuild requirements, and even debug options. An agent has enough context to construct valid documents.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only provides a generic 'document' string with 0% schema coverage, so the description must carry the full semantic burden. It does so comprehensively, specifying exact syntax for records, schemas, constraints, indexes, triggers, views, virtual tables, and frontmatter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description leads with a specific verb and resource: 'Write a record or define a DDL object'. It clearly separates this write-oriented tool from siblings like open, read, and delete, and immediately signals both data and schema-writing responsibilities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear operational guidance, including when to use 'action: rebuild' for constraint changes and how to structure records versus DDL objects. It does not explicitly contrast with the sibling tools, but the usage context is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools