Skip to main content
Glama
truaxki
by truaxki

create_table

Create new SQLite database tables to log statistical variations in conversation structure for anomaly detection.

Instructions

Create a new table in the SQLite database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesCREATE TABLE SQL statement

Implementation Reference

  • Handler for the 'create_table' tool: validates that the query starts with 'CREATE TABLE' and executes it using the database helper.
    elif name == "create_table":
        if not arguments["query"].strip().upper().startswith("CREATE TABLE"):
            raise ValueError("Only CREATE TABLE statements are allowed")
        db._execute_query(arguments["query"])
        return [types.TextContent(type="text", text="Table created successfully")]
  • Registration of the 'create_table' tool in the list_tools handler, including input schema.
    types.Tool(
        name="create_table",
        description="Create a new table in the SQLite database",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {"type": "string", "description": "CREATE TABLE SQL statement"},
            },
            "required": ["query"],
        },
    ),
  • _execute_query method in LogDatabase class: generic SQL executor that handles CREATE statements by committing and returning affected rows count. Used by the create_table handler.
    def _execute_query(self, query: str, params: dict[str, Any] | None = None) -> list[dict[str, Any]]:
        """Execute a SQL query and return results as a list of dictionaries"""
        logger.debug(f"Executing query: {query}")
        try:
            with closing(sqlite3.connect(self.db_path)) as conn:
                conn.row_factory = sqlite3.Row
                with closing(conn.cursor()) as cursor:
                    if params:
                        cursor.execute(query, params)
                    else:
                        cursor.execute(query)
    
                    if query.strip().upper().startswith(('INSERT', 'UPDATE', 'DELETE', 'CREATE', 'DROP', 'ALTER')):
                        conn.commit()
                        affected = cursor.rowcount
                        logger.debug(f"Write query affected {affected} rows")
                        return [{"affected_rows": affected}]
    
                    results = [dict(row) for row in cursor.fetchall()]
                    logger.debug(f"Read query returned {len(results)} rows")
                    return results
        except Exception as e:
            logger.error(f"Database error executing query: {e}")
            raise
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'create' which implies a mutation, but doesn't cover permissions needed, whether it's idempotent, error handling, or what happens on success/failure. This leaves significant gaps for a database mutation tool.

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?

The description is a single, clear sentence with zero wasted words. It's appropriately sized and front-loaded, efficiently conveying the core purpose without unnecessary elaboration.

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

Completeness2/5

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

For a database mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after creation (e.g., returns success confirmation, table metadata, or nothing), error conditions, or behavioral nuances, leaving the agent with incomplete context.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'query' fully documented in the schema as 'CREATE TABLE SQL statement'. The description adds no additional parameter information beyond what the schema provides, meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('create a new table') and resource ('in the SQLite database'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'write_query' which might also create tables, missing explicit distinction.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'write_query' or other SQL execution tools. The description states what it does but offers no context about prerequisites, when it's appropriate, or what makes it distinct from siblings.

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

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