dune_query_archive
Archive saved Dune Analytics queries to organize blockchain data analysis workflows. Specify a query ID to move queries to archived status for better query management.
Instructions
Archive a saved Dune query.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query_id | Yes |
Implementation Reference
- src/spice_mcp/mcp/server.py:937-942 (registration)Registration of the 'dune_query_archive' tool using the FastMCP @app.tool decorator, which defines the tool's metadata including name, title, description, and tags.@app.tool( name="dune_query_archive", title="Archive Saved Query", description="Archive a saved Dune query.", tags={"dune", "admin"}, )
- src/spice_mcp/mcp/server.py:943-975 (handler)The main handler function for the 'dune_query_archive' tool. Ensures initialization, calls QUERY_ADMIN_SERVICE.archive(query_id) to perform the archiving, logs the action to query history, and handles errors gracefully.def dune_query_archive(query_id: int) -> dict[str, Any]: _ensure_initialized() assert QUERY_ADMIN_SERVICE is not None try: result = dict(QUERY_ADMIN_SERVICE.archive(query_id)) # Log admin action if QUERY_HISTORY is not None: QUERY_HISTORY.record( execution_id=f"archive_{query_id}", query_type="query_id", query_preview=f"Archived query {query_id}", status="success", duration_ms=0, action_type="admin_action", query_id=query_id, action="archive", ) return result except Exception as e: # Log error if QUERY_HISTORY is not None: QUERY_HISTORY.record( execution_id=f"archive_{query_id}", query_type="query_id", query_preview=f"Failed to archive query {query_id}", status="error", duration_ms=0, action_type="admin_action", query_id=query_id, action="archive", error=str(e), ) return error_response(e, context={"tool": "dune_query_archive", "query_id": query_id})