Skip to main content
Glama

update_query

Modify SQL code and description for existing Dune Analytics queries to update data analysis workflows.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYes
sqlYes
descriptionNo

Implementation Reference

  • MCP tool handler for 'update_query'. Decorated with @mcp.tool(), which registers it and infers schema from type hints. Executes by delegating to dune_service.update_query and returns user-friendly status.
    @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)}"
  • Supporting utility in DuneClient service that wraps the Dune SDK's update_query API call, handling the low-level update operation.
    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