Skip to main content
Glama
truaxki
by truaxki

write_query

Execute INSERT, UPDATE, or DELETE queries to log statistical variations and unusual conversation events to a SQLite database.

Instructions

Execute an INSERT, UPDATE, or DELETE query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNon-SELECT SQL query to execute

Implementation Reference

  • Handler for the 'write_query' tool. Validates that the provided query is not a SELECT statement and executes it on the database using db._execute_query.
    if name == "write_query":
        if arguments["query"].strip().upper().startswith("SELECT"):
            raise ValueError("SELECT queries are not allowed for write_query")
        results = db._execute_query(arguments["query"])
        return [types.TextContent(type="text", text=str(results))]
  • Registration of the 'write_query' tool within the list_tools handler, defining its name, description, and JSON schema for input validation.
    types.Tool(
        name="write_query",
        description="Execute an INSERT, UPDATE, or DELETE query",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "Non-SELECT SQL query to execute"
                }
            },
            "required": ["query"]
        }
    ),
  • JSON Schema definition for the 'write_query' tool input, specifying a required 'query' string parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "Non-SELECT SQL query to execute"
            }
        },
        "required": ["query"]
    }

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/truaxki/mcp-variance-log'

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