Skip to main content
Glama

sql_execute

Execute SQL write statements (INSERT, UPDATE, DELETE) with built-in safety rails that block unsafe operations like missing WHERE clauses or DROP commands.

Instructions

Execute a write SQL statement (INSERT, UPDATE, DELETE) with safety rails.

Safety rules enforced by the engine:

  • DELETE/UPDATE without WHERE clause is BLOCKED

  • DROP TABLE/DATABASE/SCHEMA is BLOCKED

Use parameterized ? placeholders for values to prevent injection. For SELECT queries, use sql_query instead.

Examples: INSERT INTO tags (name, color) VALUES ('urgent', 'red') UPDATE documents SET source_type = 'markdown' WHERE doc_id = 'abc-123' DELETE FROM document_tags WHERE doc_id = 'abc-123' INSERT INTO metadata (key, value, doc_id) VALUES ('reviewer', 'alice', 'abc-123')

Args: statement: SQL write statement (INSERT, UPDATE, DELETE).

Returns: Dict with "affected_rows" count, or "error" if blocked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statementYes
Behavior4/5

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

Discloses safety rules (blocked DELETE/UPDATE without WHERE, DROP statements), parameterized placeholders, and return format. Lacks mention of logging or other side effects but sufficient for context.

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

Conciseness5/5

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

Well-structured with sections for safety rules, examples, args, and returns. Every sentence adds value without redundancy.

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?

Covers all necessary aspects: purpose, safety, parameters, return format, and examples. No output schema but return described adequately.

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

Parameters4/5

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

Single 'statement' parameter with examples and description of expected SQL syntax compensates for 0% schema coverage, adding meaningful guidance beyond schema.

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 clearly states the tool executes write SQL statements (INSERT, UPDATE, DELETE) with safety rails, distinguishing it from sql_query for SELECT queries.

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

Usage Guidelines5/5

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

Explicitly specifies when to use (write operations) and when not (SELECT queries), provides safety rules, parameterized placeholders, and examples.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moliver28/corpus-kb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server