Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_open_targets_query_examples

Retrieve example GraphQL queries for the Open Targets API to explore common use cases for target, drug, and disease data.

Instructions

Retrieve example GraphQL queries for the Open Targets API. Examples demonstrate common use cases.

Returns: dict: Example queries mapped by category (informationForTarget, drugsForTarget, associatedDiseases, etc.) with GraphQL query strings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function decorated with @core_mcp.tool() that returns the EXAMPLE_QUERIES dict containing 7 example GraphQL query strings for the Open Targets API.
    @core_mcp.tool()
    def get_open_targets_query_examples() -> dict:
        """Retrieve example GraphQL queries for the Open Targets API. Examples demonstrate common use cases.
    
        Returns:
            dict: Example queries mapped by category (informationForTarget, drugsForTarget, associatedDiseases, etc.) with GraphQL query strings.
        """
        return EXAMPLE_QUERIES
  • Tool registration via @core_mcp.tool() decorator on the handler function, using the core_mcp FastMCP server instance from biocontext_kb.core._server.
    from biocontext_kb.core._server import core_mcp
    
    EXAMPLE_QUERIES = {
        "informationForTargetByEnsemblId": """
  • EXAMPLE_QUERIES dict containing 7 pre-defined example GraphQL queries covering targets, diseases, drugs, and associations.
    EXAMPLE_QUERIES = {
        "informationForTargetByEnsemblId": """
            query informationForTargetByEnsemblId {
                target(ensemblId: "ENSG00000169083") {
                    id
                    approvedSymbol
                    tractability {
                        modality
                        label
                        value
                    }
                    safetyLiabilities {
                        event
                        eventId
                        biosamples {
                            cellFormat
                            cellLabel
                            tissueLabel
                            tissueId
                        }
                        effects {
                            dosing
                            direction
                        }
                        studies {
                            name
                            type
                            description
                        }
                        datasource
                        literature
                    }
                }
            }
        """,
        "drugsForTargetByEnsemblId": """
            query geneAssociatedDrugs {
                target(ensemblId: "ENSG00000159640") {
                    id
                    pharmacogenomics {
                        isDirectTarget
                        target {
                            approvedName
                        }
                        drugs {
                            drug {
                            id
                            name
                            mechanismsOfAction {
                                rows {
                                targets {
                                    approvedName
                                }
                                }
                                uniqueTargetTypes
                                uniqueActionTypes
                            }
                            isApproved
                            }
                        }
                    }
                }
            }
        """,
        "associatedDiseasesForTargetByEnsemblId": """
            query associatedDiseasesForTargetByEnsemblId {
                target(ensemblId: "ENSG00000127318") {
                    id
                    approvedSymbol
                    associatedDiseases {
                        count
                        rows {
                            disease {
                                id
                                name
                            }
                            datasourceScores {
                                id
                                score
                            }
                        }
                    }
                }
            }
        """,
        "informationForDiseaseByEFOId": """
            query informationForDiseaseByEFOId {
                disease(efoId: "EFO_0000222") {
                    id
                    name
                    phenotypes {
                        rows {
                            phenotypeHPO {
                                id
                                name
                                description
                                namespace
                            }
                            phenotypeEFO {
                                id
                                name
                            }
                            evidence {
                                aspect
                                bioCuration
                                diseaseFromSourceId
                                diseaseFromSource
                                evidenceType
                                frequency
                                frequencyHPO {
                                    name
                                    id
                                }
                                qualifierNot
                                onset {
                                    name
                                    id
                                }
                                modifiers {
                                    name
                                    id
                                }
                                references
                                sex
                                resource
                            }
                        }
                    }
                }
            }
        """,
        "knownDrugsForDiseaseByEFOId": """
            query knownDrugsForDiseaseByEFOId {
                disease(efoId: "EFO_0004705") {
                    id
                    name
                    knownDrugs {
                        count
                        uniqueTargets
                        uniqueDrugs
                        rows {
                            drugId
                            drugType
                            prefName
                            targetId
                            targetClass
                            approvedSymbol
                            mechanismOfAction
                            phase
                            status
                            diseaseId
                            drug {
                                id
                                name
                                maximumClinicalTrialPhase
                                description
                                synonyms
                            }
                            target {
                                id
                                approvedSymbol
                                approvedName
                            }
                        }
                    }
                }
            }
        """,
        "associatedTargetsForDiseaseByEFOId": """
            query associatedTargets {
                disease(efoId: "EFO_0000349") {
                    id
                    name
                    associatedTargets {
                        count
                        rows {
                            target {
                                id
                                approvedSymbol
                            }
                            score
                        }
                    }
                }
            }
        """,
        "informationForDrugByChemblId": """
            query informationForDrugByChemblId {
                drug(chemblId: "CHEMBL25") {
                    name
                    id
                    yearOfFirstApproval
                    tradeNames
                    isApproved
                    hasBeenWithdrawn
                    blackBoxWarning
                    drugType
                    approvedIndications
                    mechanismsOfAction {
                        uniqueTargetTypes
                        uniqueActionTypes
                    }
                    linkedTargets {
                        rows {
                            id
                            approvedName
                            pathways {
                                pathwayId
                                pathway
                                topLevelTerm
                            }
                        }
                    }
                }
            }
        """,
    }
  • Function signature defines return type as dict - no input parameters and returns a dictionary of example query strings.
    def get_open_targets_query_examples() -> dict:
        """Retrieve example GraphQL queries for the Open Targets API. Examples demonstrate common use cases.
    
        Returns:
            dict: Example queries mapped by category (informationForTarget, drugsForTarget, associatedDiseases, etc.) with GraphQL query strings.
        """
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It only describes return structure (dict mapping categories), lacking side effects, rate limits, or authorization needs. The read-only nature is implied but not confirmed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences plus return type line, front-loaded with key info. No redundant or missing words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given output schema exists, the description adequately covers the tool's purpose and return format. The tool is simple (no parameters), and nothing critical is omitted.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so baseline is 4. Description adds value by specifying the return shape (mapped by category) and listing example categories, which aids understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and resource 'example GraphQL queries for the Open Targets API', distinguishing it from siblings like bc_query_open_targets_graphql and bc_get_open_targets_graphql_schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for obtaining example queries, but does not explicitly state when to use this tool versus alternatives like executing queries or getting schema. No exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/biocontext-ai/knowledgebase-mcp'

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