Skip to main content
Glama

update_query

Modify SQL code and description for an existing Dune Analytics query to update data analysis logic and documentation.

Instructions

Update SQL/description of an existing query. (Requires Paid Plan)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYes
sqlYes
descriptionNo

Implementation Reference

  • The main handler function for the MCP 'update_query' tool. It is decorated with @mcp.tool(), which registers it as a tool named 'update_query'. This function updates an existing Dune query by calling the DuneService.
    @mcp.tool()
    def update_query(query_id: int, sql: str, description: str = None) -> str:
        """
        Update SQL/description of an existing query. (Requires Paid Plan)
        """
        try:
            dune_service.update_query(query_id, sql, description)
            return f"Successfully updated Query {query_id}."
        except Exception as e:
            return f"Error updating query: {str(e)}"
  • Helper method in DuneService class that implements the low-level update operation using the DuneClient SDK, called by the main tool handler.
    def update_query(self, query_id: int, sql: str, description: str = None, name: str = None) -> int:
        """
        Updates an existing query. Returns the Query ID.
        """
        try:
            # client.update_query takes query_id and optional fields
            # Removed 'description' arg as it's not supported in current SDK version
            self.client.update_query(query_id, query_sql=sql, name=name)
            return query_id
        except Exception as e:
            logger.error(f"Error updating query {query_id}: {e}")
            raise

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/nice-bills/dune-mcp'

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