Skip to main content
Glama
xraywu

Wegene Assistant MCP Server

by xraywu

wegene-get-report

Retrieve genetic test reports from WeGene profiles using specific report endpoints, IDs, and profile identifiers to access personalized genetic data.

Instructions

Get a specific genetic test report from a profile

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
report_endpointYesThe endpoint of the report
report_idYesThe ID of the report
profile_idYesThe ID of the profile

Implementation Reference

  • Core handler function that performs the HTTP POST request to WeGene API to retrieve the genetic report JSON using the provided parameters and stored access token.
    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
  • MCP server.call_tool handler that dispatches the tool call by extracting input arguments and invoking the core get_wegene_report function.
    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 properties: report_endpoint, report_id, profile_id.
    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"]
        },
    )
  • Registration of the wegene-get-report tool in the MCP server's list_tools method, including all tools.
    return [
        types.Tool(
            name="wegene-oauth",
            description="Authorizing a user's account using WeGene Open API with oAuth2 protocol and retrieve a valid access token for further use",
            inputSchema={
                "type": "object",
                "properties": {},
            },
        ),
        types.Tool(
            name="wegene-get-profiles",
            description="Retrieve all the profiles under the current account",
            inputSchema={
                "type": "object",
                "properties": {}
            },
        ),
        types.Tool(
            name="wegene-get-report-info",
            description="Get all available report information",
            inputSchema={
                "type": "object",
                "properties": {}
            },
        ),
        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"]
            },
        )
    ]

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/xraywu/mcp-wegene-assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server