Skip to main content
Glama

get_protein_info

Retrieve detailed protein function and sequence data from UniProt by entering a valid accession number. Access protein names, organism information, and more for analysis.

Instructions

Get protein function and sequence information from UniProt using an accession No.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt Accession No. (e.g., P12345)

Implementation Reference

  • Core handler function that fetches protein data from UniProt API, extracts function, sequence, length, organism, caches the result, and returns structured ProteinInfo.
    async def fetch_protein_info(accession: str) -> ProteinInfo: """Fetch protein information from UniProt API with caching.""" # Check cache first cached_data = self.cache.get(accession) if cached_data: logger.info(f"Cache hit for {accession}") return cached_data logger.info(f"Fetching data for {accession}") async with httpx.AsyncClient() as client: response = await client.get( f"{API_BASE_URL}/{accession}", headers={"Accept": "application/json"}, ) response.raise_for_status() data = response.json() # Extract relevant information protein_info: ProteinInfo = { "accession": accession, "protein_name": data.get("proteinDescription", {}) .get("recommendedName", {}) .get("fullName", {}) .get("value", "Unknown"), "function": [], "sequence": "", "length": 0, "organism": "Unknown", } # Extract function information safely for comment in data.get("comments", []): if comment.get("commentType") == "FUNCTION": texts = comment.get("texts", []) if texts: protein_info["function"].extend( [text.get("value", "") for text in texts] ) # Add sequence information seq_info = data.get("sequence", {}) org_info = data.get("organism", {}) protein_info.update( { "sequence": seq_info.get("value", ""), "length": seq_info.get("length", 0), "organism": org_info.get("scientificName", "Unknown"), } ) # Cache the result self.cache.set(accession, protein_info) return protein_info
  • Tool dispatch logic in call_tool handler specifically for get_protein_info: validates input and calls the core fetch function.
    if name == "get_protein_info": accession = arguments.get("accession") if not accession: raise ValueError("Accession No. is required") protein_info = await fetch_protein_info(accession) return [ TextContent( type="text", text=json.dumps(protein_info, indent=2) ) ]
  • Registers the get_protein_info tool in the list_tools() function, providing name, description, and input schema.
    Tool( name="get_protein_info", description=( "Get protein function and sequence information from UniProt " "using an accession No." ), inputSchema={ "type": "object", "properties": { "accession": { "type": "string", "description": "UniProt Accession No. (e.g., P12345)", } }, "required": ["accession"], }, ), Tool(
  • TypedDict defining the output schema/structure for protein information returned by the tool.
    class ProteinInfo(TypedDict): """Type definition for protein information.""" accession: str protein_name: str function: list[str] sequence: str length: int organism: str

Other Tools

Related 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/TakumiY235/uniprot-mcp-server'

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