Skip to main content
Glama
PuemMTH
by PuemMTH

delete_command_tool

Remove a command-usage record from the MCP server's history by specifying its unique identifier.

Instructions

Delete a command-usage record by its id.

Args:
    row_id: The id field from history records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
row_idYes

Implementation Reference

  • Main MCP tool handler for delete_command_tool. Decorated with @mcp.tool() and calls delete_command() to perform the actual deletion, returning appropriate success/warning messages.
    @mcp.tool()
    def delete_command_tool(row_id: int) -> str:
        """
        Delete a command-usage record by its id.
    
        Args:
            row_id: The id field from history records
        """
        deleted = delete_command(row_id=row_id)
        if deleted:
            return f"🗑️ Deleted record id={row_id}"
        return f"⚠️ No record found with id={row_id}"
  • Tool registration point - the @mcp.tool() decorator registers delete_command_tool with the MCP server, exposing it as an available tool.
    @mcp.tool()
  • Database helper function that executes the actual DELETE SQL query against PostgreSQL, returning True if a row was deleted or False if not found.
    def delete_command(row_id: int) -> bool:
        """Delete a single record by id. Returns True if a row was deleted."""
        conn = get_connection()
        with conn.cursor() as cur:
            cur.execute("DELETE FROM command_log WHERE id = %s", (row_id,))
            deleted = cur.rowcount > 0
        conn.commit()
        conn.close()
        return deleted

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/PuemMTH/mcp-commands'

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