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
| Name | Required | Description | Default |
|---|---|---|---|
| query_id | Yes | ||
| sql | Yes | ||
| description | No |
Implementation Reference
- src/main.py:165-174 (handler)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)}"
- src/services/dune_client.py:409-420 (helper)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