wegene-get-report
Retrieve a specific genetic test report from a user profile by providing the required report endpoint, report ID, and profile ID. Facilitates access to genetic data through API integration.
Instructions
Get a specific genetic test report from a profile
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profile_id | Yes | The ID of the profile | |
| report_endpoint | Yes | The endpoint of the report | |
| report_id | Yes | The ID of the report |
Input Schema (JSON Schema)
{
"properties": {
"profile_id": {
"description": "The ID of the profile",
"type": "string"
},
"report_endpoint": {
"description": "The endpoint of the report",
"type": "string"
},
"report_id": {
"description": "The ID of the report",
"type": "string"
}
},
"required": [
"report_endpoint",
"report_id",
"profile_id"
],
"type": "object"
}
Implementation Reference
- Core handler function that fetches the genetic testing report from WeGene API using the access token, report endpoint, ID, and profile ID. Makes a POST request and returns the JSON response.async def get_wegene_report(report_endpoint: str, report_id: str, profile_id: str) -> str: """ Read report from WeGene Open API :param uri: resource uri, wegene://{report_endpoint}/{report_id}/{profile_id} :return: JSON string of the results """ # Get WeGene access token access_token = redislite.Redis(os.getenv('REDIS_DB_PATH')).get('wegene_access_token') if not access_token: raise ValueError("No valid user access token. Please use wegene-oauth tool first.") # Prepare request url = f"https://api.wegene.com/{report_endpoint}/{profile_id}" headers = { "Authorization": f"Bearer {access_token.decode('utf-8')}", "Content-Type": "application/json" } data = { "report_id": report_id } # Call WeGene API async with httpx.AsyncClient() as client: response = await client.post(url, headers=headers, json=data) if response.status_code != 200: raise ValueError(f"Failed to retrieve report: {response.status_code} {response.text}") return response.text
- src/wegene_assistant/server.py:163-184 (registration)Registration of the 'wegene-get-report' tool in list_tools(), including name, description, and input schema definition.types.Tool( name="wegene-get-report", description="Get a specific genetic test report from a profile", inputSchema={ "type": "object", "properties": { "report_endpoint": { "type": "string", "description": "The endpoint of the report" }, "report_id": { "type": "string", "description": "The ID of the report" }, "profile_id": { "type": "string", "description": "The ID of the profile" } }, "required": ["report_endpoint", "report_id", "profile_id"] }, )
- src/wegene_assistant/server.py:244-256 (handler)Dispatch handler in handle_call_tool() that extracts arguments and calls the core get_wegene_report function, returning the result as TextContent.elif name == "wegene-get-report": if not arguments: raise ValueError("Missing arguments") return [ types.TextContent( type="text", text=await get_wegene_report( arguments["report_endpoint"], arguments["report_id"], arguments["profile_id"] ) ) ]
- Input schema definition for the wegene-get-report tool, specifying required parameters: report_endpoint, report_id, profile_id.inputSchema={ "type": "object", "properties": { "report_endpoint": { "type": "string", "description": "The endpoint of the report" }, "report_id": { "type": "string", "description": "The ID of the report" }, "profile_id": { "type": "string", "description": "The ID of the profile" } }, "required": ["report_endpoint", "report_id", "profile_id"] },