Skip to main content
Glama

get_spellbook_file_content

Fetch raw content of Spellbook files from GitHub to access Dune Analytics queries and data models directly.

Instructions

Fetch raw content of a Spellbook file from GitHub.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler function decorated with @mcp.tool(). It fetches the Spellbook file content via dune_service and formats the response.
    @mcp.tool() def get_spellbook_file_content(path: str) -> str: """ Fetch raw content of a Spellbook file from GitHub. """ content = dune_service.get_spellbook_file_content(path) if not content: return f"Error: Could not fetch content for '{path}'." return f"File: {path}\n\n{content}"
  • Helper method in DuneService class that fetches raw file content from GitHub Spellbook repo, with caching support.
    def get_spellbook_file_content(self, path: str) -> Optional[str]: """ Fetches the raw content of a file from the duneanalytics/spellbook GitHub repository. 'path' should be the full path within the repository (e.g., 'models/dex/uniswap/trades.sql'). Content is cached for 24 hours. """ cache_key = f"content:{path}" cached_content = self.cache.get("github", cache_key) if cached_content: return cached_content # GitHub raw content URL pattern raw_url = f"https://raw.githubusercontent.com/duneanalytics/spellbook/main/{path}" try: response = requests.get(raw_url, timeout=15) response.raise_for_status() content = response.text self.cache.set("github", cache_key, content) return content except Exception as e: logger.error(f"Failed to fetch content for {path} from GitHub: {e}") return None

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