get_project
Retrieve cryptocurrency project details by ID, with options to include team members and investors for comprehensive analysis.
Instructions
Obtain project details according to the project ID.
Args:
project_id: The unique identifier for the project.
include_team: Whether to include team member information, default is false.
include_investors: Whether to include investor information, default is false.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| include_team | No | ||
| include_investors | No |
Implementation Reference
- server.py:77-108 (handler)The async handler function that implements the core logic of the 'get_project' MCP tool, handling API calls and response formatting.async def get_project( project_id: int, include_team: bool = False, include_investors: bool = False, ) -> str: """Obtain project details according to the project ID. Args: project_id: The unique identifier for the project. include_team: Whether to include team member information, default is false. include_investors: Whether to include investor information, default is false. """ # Prepare request data data = { "project_id": project_id, "include_team": include_team, "include_investors": include_investors, } # Fetch data from the API response = await make_request("get_item", data) # Check if there was an error if "Error" in response: return f"Error: {response['Error']}" # Check if data is found if response.get("result") != 200 or not response.get("data"): return f"No project found with ID {project_id}." # Return the formatted results return json.dumps(response["data"], indent=2)
- server.py:76-76 (registration)The decorator that registers 'get_project' as an MCP tool with FastMCP.@mcp.tool()
- server.py:77-88 (schema)Input schema defined by function parameters with type hints and comprehensive docstring describing args.async def get_project( project_id: int, include_team: bool = False, include_investors: bool = False, ) -> str: """Obtain project details according to the project ID. Args: project_id: The unique identifier for the project. include_team: Whether to include team member information, default is false. include_investors: Whether to include investor information, default is false. """
- server.py:28-49 (helper)Supporting helper function used by get_project to perform the actual HTTP request to RootData API.async def make_request(endpoint: str, data: dict) -> dict[str, any] | None: """Make a request to the RootData API with proper error handling.""" headers = { "Content-Type": "application/json", "language": "en", } if api_key := os.environ.get("ROOTDATA_API_KEY"): headers["apikey"] = api_key else: return {"Error": "ROOTDATA_API_KEY environment variable is not set"} url = f"{ROOTDATA_API_BASE}/{endpoint}" async with httpx.AsyncClient() as client: try: response = await client.post(url, headers=headers, json=data, timeout=30.0) response.raise_for_status() return response.json() except Exception as e: return {"Error": str(e)}