bc_get_open_targets_graphql_schema
Retrieve the GraphQL schema for Open Targets to construct precise queries for biomedical data exploration and analysis.
Instructions
Retrieve the Open Targets GraphQL schema for query construction.
Returns: dict: Schema string in format {'schema': '...'} containing GraphQL type definitions or error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'get_open_targets_graphql_schema' tool (likely invoked as 'bc_get_open_targets_graphql_schema' due to 'BC' server prefix). It fetches the GraphQL schema from Open Targets API and returns it as a formatted string or error.@core_mcp.tool() def get_open_targets_graphql_schema() -> dict: """Retrieve the Open Targets GraphQL schema for query construction. Returns: dict: Schema string in format {'schema': '...'} containing GraphQL type definitions or error message. """ base_url = "https://api.platform.opentargets.org/api/v4/graphql" try: schema = fetch_graphql_schema(base_url) return {"schema": print_schema(schema)} except Exception as e: return {"error": f"Failed to fetch Open Targets GraphQL schema: {e!s}"}
- src/biocontext_kb/core/opentargets/__init__.py:1-1 (registration)Import statement that loads the tool handler, executing the @core_mcp.tool() decorator for registration.from ._get_open_targets_graphql_schema import get_open_targets_graphql_schema
- src/biocontext_kb/core/__init__.py:14-14 (registration)Wildcard import of the opentargets module, which triggers the import and registration of the tool.from .opentargets import *
- src/biocontext_kb/core/_server.py:3-6 (registration)Definition of the core_mcp FastMCP server instance named 'BC', which likely prefixes tool names with 'bc_' and where tools are registered via decorators.core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )