Skip to main content
Glama

BioContextAI Knowledgebase MCP

Official

bc_query_kegg

Query the KEGG API to retrieve biological data such as pathways, genes, compounds, and diseases. Convert identifiers, search entries, and link related datasets using supported operations for comprehensive analysis.

Instructions

Execute a KEGG API query.

This function provides access to the KEGG API, allowing you to query biological data across pathways, genes, compounds, diseases, and more. The function can perform all KEGG API operations and accepts various parameters depending on the operation.

When searching for genes in KEGG, you typically need KEGG IDs rather than gene symbols. Use the get_kegg_id_by_gene_symbol function first to convert gene symbols to KEGG IDs.

Common operations:

  • info: Get database metadata (e.g., operation=info, database=PATHWAY)
  • list: List entries in a database (e.g., operation=list, database=PATHWAY, query="hsa")
  • get: Retrieve specific entries (e.g., operation=get, entries=["hsa:7157"])
  • find: Search for entries by keyword (e.g., operation=find, database=COMPOUND, query="glucose")
  • link: Find related entries (e.g., operation=link, target_db=PATHWAY, entries=["hsa:7157"])
  • conv: Convert between identifiers (e.g., operation=conv, target_db=NCBI_GENEID, entries=["hsa:7157"])

Args: operation (KeggOperation): The KEGG operation to perform. database (KeggDatabase | KeggOutsideDb | str, optional): The database to query. target_db (KeggDatabase | KeggOutsideDb | str, optional): The target database for conversion. source_db (KeggDatabase | KeggOutsideDb | str, optional): The source database for conversion. query (str, optional): The query string for FIND or LIST operations. option (KeggOption | KeggFindOption | KeggRdfFormat, optional): Additional options for the operation. entries (List[str], optional): List of entries for GET or LINK operations.

Returns: str | dict: The result of the KEGG query or an error message.

Examples: # List human pathways >>> query_kegg(operation=KeggOperation.LIST, database=KeggDatabase.PATHWAY, query="hsa")

# Get data for the glycolysis pathway >>> query_kegg(operation=KeggOperation.GET, entries=["hsa00010"]) # Get data for the TP53 gene >>> query_kegg(operation=KeggOperation.GET, entries=["hsa:7157"]) # Get amino acid sequence for TP53 >>> query_kegg(operation=KeggOperation.GET, entries=["hsa:7157"], option=KeggOption.AASEQ) # Find compounds with formula C7H10O5 >>> query_kegg(operation=KeggOperation.FIND, database=KeggDatabase.COMPOUND, query="C7H10O5", option="formula") # Find pathways related to TP53 >>> query_kegg(operation=KeggOperation.LINK, target_db=KeggDatabase.PATHWAY, entries=["hsa:7157"]) # Convert KEGG ID to NCBI Gene ID >>> query_kegg(operation=KeggOperation.CONV, target_db="ncbi-geneid", source_db="hsa:7157") # Get information about a specific pathway >>> query_kegg(operation=KeggOperation.GET, entries=["hsa00010"]) # Get the compound ID for caffeine >>> query_kegg(operation=KeggOperation.FIND, database=KeggDatabase.COMPOUND, query="caffeine") # Get the drug ID for acetaminophen >>> query_kegg(operation=KeggOperation.FIND, database=KeggDatabase.DRUG, query="acetaminophen") # Check if two drugs interact (ibuprofen and aspirin) >>> query_kegg(operation=KeggOperation.DDI, entries=["dr:D00126", "dr:D00109"])

Input Schema

NameRequiredDescriptionDefault
databaseNoThe KEGG database to query (e.g., pathway, genes, compound) or organism code (e.g., hsa)
entriesNoList of KEGG entry IDs (e.g., ['hsa:7157', 'hsa:00010'])
operationYesThe KEGG API operation to perform (info, list, find, get, conv, link, ddi)
optionNoAdditional options like sequence formats, chemical formula search, etc.
queryNoQuery string for operations like FIND, or organism code for LIST
source_dbNoSource database for conversion or linking operations
target_dbNoTarget database for conversion or linking operations

Input Schema (JSON Schema)

{ "$defs": { "KeggDatabase": { "description": "Primary KEGG databases.\n\nThese databases contain different types of biological data in the KEGG system.\nPathway and pathway-related databases: pathway, brite, module, ko\nGenes and genomes: genes, genome (organism-specific databases use KEGG organism codes)\nChemical compounds: compound, glycan, reaction, rclass, enzyme\nDisease, drugs, and variants: variant, disease, drug, dgroup", "enum": [ "kegg", "pathway", "brite", "module", "ko", "genome", "compound", "glycan", "reaction", "rclass", "enzyme", "network", "variant", "disease", "drug", "dgroup", "genes", "ligand", "organism" ], "title": "KeggDatabase", "type": "string" }, "KeggFindOption": { "description": "Options for FIND operation on compounds/drugs.\n\nThese options specify the search criteria for chemical compounds and drugs.", "enum": [ "formula", "exact_mass", "mol_weight", "nop" ], "title": "KeggFindOption", "type": "string" }, "KeggOperation": { "description": "KEGG API operations.\n\nThese operations correspond to the different API endpoints in the KEGG REST API.\nFor detailed information on each operation, see: https://www.kegg.jp/kegg/rest/keggapi.html", "enum": [ "info", "list", "find", "get", "conv", "link", "ddi" ], "title": "KeggOperation", "type": "string" }, "KeggOption": { "description": "Options for GET operation.\n\nThese options specify the format or type of data to retrieve for database entries.", "enum": [ "aaseq", "ntseq", "mol", "kcf", "image", "conf", "kgml", "json" ], "title": "KeggOption", "type": "string" }, "KeggOutsideDb": { "description": "Outside databases integrated in KEGG.\n\nThese external databases can be used in CONV (conversion) and LINK operations.", "enum": [ "pubmed", "ncbi-geneid", "ncbi-proteinid", "uniprot", "pubchem", "chebi", "atc", "jtc", "ndc", "yj", "yk" ], "title": "KeggOutsideDb", "type": "string" }, "KeggRdfFormat": { "description": "RDF output formats for LINK with RDF option.\n\nThese options specify the format of returned RDF data.", "enum": [ "turtle", "n-triple" ], "title": "KeggRdfFormat", "type": "string" } }, "properties": { "database": { "anyOf": [ { "$ref": "#/$defs/KeggDatabase" }, { "$ref": "#/$defs/KeggOutsideDb" }, { "type": "string" }, { "type": "null" } ], "default": null, "description": "The KEGG database to query (e.g., pathway, genes, compound) or organism code (e.g., hsa)", "title": "Database" }, "entries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of KEGG entry IDs (e.g., ['hsa:7157', 'hsa:00010'])", "title": "Entries" }, "operation": { "$ref": "#/$defs/KeggOperation", "description": "The KEGG API operation to perform (info, list, find, get, conv, link, ddi)", "title": "Operation" }, "option": { "anyOf": [ { "$ref": "#/$defs/KeggOption" }, { "$ref": "#/$defs/KeggFindOption" }, { "$ref": "#/$defs/KeggRdfFormat" }, { "type": "null" } ], "default": null, "description": "Additional options like sequence formats, chemical formula search, etc.", "title": "Option" }, "query": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Query string for operations like FIND, or organism code for LIST", "title": "Query" }, "source_db": { "anyOf": [ { "$ref": "#/$defs/KeggDatabase" }, { "$ref": "#/$defs/KeggOutsideDb" }, { "type": "string" }, { "type": "null" } ], "default": null, "description": "Source database for conversion or linking operations", "title": "Source Db" }, "target_db": { "anyOf": [ { "$ref": "#/$defs/KeggDatabase" }, { "$ref": "#/$defs/KeggOutsideDb" }, { "type": "string" }, { "type": "null" } ], "default": null, "description": "Target database for conversion or linking operations", "title": "Target Db" } }, "required": [ "operation" ], "type": "object" }
Install Server

Other Tools from BioContextAI Knowledgebase MCP

Related Tools

    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