load_whitepaper
Load cryptocurrency project whitepapers into a structured knowledge base by providing the project name and PDF URL. Enables AI agents to access and analyze whitepaper content for enhanced learning.
Instructions
Load a whitepaper PDF from a URL into the knowledge base.
Parameters:
project_name (str): The name of the cryptocurrency project (e.g., 'bitcoin', 'ethereum').
url (str): The URL of the whitepaper PDF to download and load.
Returns:
str: A message indicating success or failure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | Yes | ||
| url | Yes |
Implementation Reference
- src/crypto_whitepapers_mcp/cli.py:64-88 (handler)The main handler function for the 'load_whitepaper' tool. It is registered via the @mcp.tool() decorator. Downloads a PDF whitepaper from the provided URL, saves it locally, and loads it into the PDFKnowledgeBase for vector search.@mcp.tool() def load_whitepaper(project_name: str, url: str, ctx: Context = None) -> str: """Load a whitepaper PDF from a URL into the knowledge base. Parameters: project_name (str): The name of the cryptocurrency project (e.g., 'bitcoin', 'ethereum'). url (str): The URL of the whitepaper PDF to download and load. Returns: str: A message indicating success or failure. """ try: # Sanitize project name for filename safe_project_name = project_name.lower().replace(" ", "_") file_path = os.path.join(WHITEPAPERS_DIR, f"{safe_project_name}.pdf") # Download PDF urllib.request.urlretrieve(url, file_path) # Load into knowledge base knowledge_base.load() return f"Successfully loaded {project_name} whitepaper from {url}" except Exception as e: return f"Error loading {project_name} whitepaper: {str(e)}"