Skip to main content
Glama
mohammadnajeeb

NCBI Gene MCP Server

fetch_protein_info

Retrieve detailed protein information from NCBI using a protein ID to access metadata and biological data for research and analysis.

Instructions

Fetch detailed information for a specific protein ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_idYesNCBI Protein ID

Implementation Reference

  • Core handler function that performs the NCBI esummary API call for protein database and constructs ProteinInfo object.
    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")
        )
  • Pydantic model defining the structure and validation for the protein information output.
    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 tool registration entry providing the tool 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"]
        }
    },
  • MCP server dispatch handler that extracts arguments, calls bridge, serializes to JSON, and sends response.
    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}"
            }]
        })
  • Input schema definition for the fetch_protein_info tool in MCP registration.
    "inputSchema": {
        "type": "object",
        "properties": {
            "protein_id": {
                "type": "string",
                "description": "NCBI Protein ID"
            }
        },
        "required": ["protein_id"]
    }

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/mohammadnajeeb/ncbi_gene_mcp_client'

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