Skip to main content
Glama

dune_query_fork

Create a copy of an existing Dune Analytics query to modify and customize for your blockchain data analysis needs without starting from scratch.

Instructions

Fork an existing saved Dune query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_query_idYes
nameNo

Implementation Reference

  • Main execution logic for the dune_query_fork tool: initializes services, checks save permissions, calls QUERY_ADMIN_SERVICE.fork to create a fork of the source query, logs the action to query history, and handles errors.
    def dune_query_fork(source_query_id: int, name: str | None = None) -> dict[str, Any]: _ensure_initialized() if CONFIG is None or not CONFIG.allow_saves: return error_response( ValueError("Saving queries is disabled. Set SPICE_DUNE_ALLOW_SAVES=true to enable."), context={"tool": "dune_query_fork", "allow_saves": False} ) assert QUERY_ADMIN_SERVICE is not None try: result = dict(QUERY_ADMIN_SERVICE.fork(source_query_id, name=name)) # Log admin action if QUERY_HISTORY is not None: query_id = result.get("query_id") or source_query_id QUERY_HISTORY.record( execution_id=f"fork_{source_query_id}", query_type="query_id", query_preview=f"Forked query {source_query_id}", status="success", duration_ms=0, action_type="admin_action", query_id=query_id, action="fork", source_query_id=source_query_id, ) return result except Exception as e: # Log error if QUERY_HISTORY is not None: QUERY_HISTORY.record( execution_id=f"fork_{source_query_id}", query_type="query_id", query_preview=f"Failed to fork query {source_query_id}", status="error", duration_ms=0, action_type="admin_action", query_id=source_query_id, action="fork", error=str(e), ) return error_response(e, context={"tool": "dune_query_fork", "source_query_id": source_query_id})
  • Registers the dune_query_fork tool in FastMCP with metadata: title, description, and tags.
    @app.tool( name="dune_query_fork", title="Fork Saved Query", description="Fork an existing saved Dune query. Requires SPICE_DUNE_ALLOW_SAVES=true.", tags={"dune", "admin"}, )

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/Evan-Kim2028/spice-mcp'

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