fetch_protein_info
Retrieve detailed metadata for a protein using its NCBI Protein ID, including gene data, sequence information, and related annotations, via the NCBI Gene MCP Server.
Instructions
Fetch detailed information for a specific protein ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| protein_id | Yes | NCBI Protein ID |
Implementation Reference
- ncbi_gene_mcp_client/bridge.py:173-203 (handler)Core handler implementing the tool logic: makes NCBI Entrez esummary request to 'protein' DB, parses response, and returns ProteinInfo model.def fetch_protein_info(self, protein_id: str) -> ProteinInfo: """ Fetch detailed information for a specific protein. Args: protein_id: NCBI Protein ID Returns: ProteinInfo object with protein details """ params = { "db": "protein", "id": protein_id } response = self._make_request("esummary", params) result = response.get("result", {}) protein_data = result.get(protein_id) if not protein_data: raise Exception(f"No data found for protein ID: {protein_id}") return ProteinInfo( protein_id=protein_id, title=protein_data.get("title", ""), organism=protein_data.get("organism", ""), length=protein_data.get("slen"), mol_type=protein_data.get("moltype") )
- ncbi_gene_mcp_client/mcp_server.py:103-116 (registration)Tool registration in MCP tools/list handler, defining name, description, and input schema.{ "name": "fetch_protein_info", "description": "Fetch detailed information for a specific protein ID", "inputSchema": { "type": "object", "properties": { "protein_id": { "type": "string", "description": "NCBI Protein ID" } }, "required": ["protein_id"] } },
- ncbi_gene_mcp_client/models.py:23-31 (schema)Pydantic model defining the output structure for protein information.class ProteinInfo(BaseModel): """Model for protein information from NCBI Entrez.""" protein_id: str = Field(description="NCBI Protein ID") title: str = Field(description="Protein title") organism: str = Field(description="Organism scientific name") length: Optional[int] = Field(default=None, description="Protein sequence length") mol_type: Optional[str] = Field(default=None, description="Molecule type")
- MCP server dispatching logic for the tool: validates input, calls bridge handler, formats JSON response for MCP protocol.elif name == "fetch_protein_info": protein_id = arguments.get("protein_id") if not protein_id: raise ValueError("protein_id is required") result = self.bridge.fetch_protein_info(protein_id) protein_json = result.model_dump_json(indent=2) self.send_response({ "content": [{ "type": "text", "text": f"Protein Information for ID {protein_id}:\n\n{protein_json}" }] })