ask_whitepapers
Search and retrieve relevant cryptocurrency whitepaper content by entering a query, optionally filtered by project name, to access up to 5 matching results from the knowledge base.
Instructions
Search the knowledge base for information related to a query, optionally filtered by project.
Parameters:
query (str): The search query to find relevant whitepaper content.
project_name (str, optional): The name of the cryptocurrency project to filter results (e.g., 'bitcoin'). If None, searches all whitepapers.
Returns:
str: A string containing up to 5 matching results from the knowledge base.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | No | ||
| query | Yes |
Implementation Reference
- src/crypto_whitepapers_mcp/cli.py:90-114 (handler)The core handler function for the 'ask_whitepapers' MCP tool. It is decorated with @mcp.tool(), which registers it. The function searches a vector database of cryptocurrency whitepaper PDFs for relevant content matching the query, optionally filtered to a specific project's whitepaper, and returns the top 5 results concatenated.@mcp.tool() def ask_whitepapers(query: str, project_name: str = None, ctx: Context = None) -> str: """Search the knowledge base for information related to a query, optionally filtered by project. Parameters: query (str): The search query to find relevant whitepaper content. project_name (str, optional): The name of the cryptocurrency project to filter results (e.g., 'bitcoin'). If None, searches all whitepapers. Returns: str: A string containing up to 5 matching results from the knowledge base. """ # Apply filter if project_name is provided filters = [{"source": f"{project_name.lower()}.pdf"}] if project_name else None results = knowledge_base.search( query=query, num_documents=5, filters=filters ) if not results: return f"No matches found for query '{query}'" + (f" in {project_name} whitepaper" if project_name else "") return "\n\n".join([r.content for r in results])
- Input/output schema defined by the function signature and docstring parameters.def ask_whitepapers(query: str, project_name: str = None, ctx: Context = None) -> str: """Search the knowledge base for information related to a query, optionally filtered by project. Parameters: query (str): The search query to find relevant whitepaper content. project_name (str, optional): The name of the cryptocurrency project to filter results (e.g., 'bitcoin'). If None, searches all whitepapers. Returns: str: A string containing up to 5 matching results from the knowledge base. """
- src/crypto_whitepapers_mcp/cli.py:90-90 (registration)The @mcp.tool() decorator registers the 'ask_whitepapers' function as an MCP tool.@mcp.tool()
- A prompt that instructs the model to use the 'ask_whitepapers' tool for analyzing tokenomics.@mcp.prompt() def analyze_tokenomics(project_name: str) -> GetPromptResult: """Analyze the tokenomics described in a cryptocurrency whitepaper""" return GetPromptResult( description="Analyze tokenomics of a cryptocurrency", messages=[ PromptMessage( role="user", content=TextContent( type="text", text=f"Analyze the tokenomics (token distribution, supply, incentives) described in the {project_name} whitepaper. " f"Use the 'ask_whitepapers' tool to search the knowledge base for relevant information." ) ) ] )