Skip to main content
Glama
geneontology

Noctua MCP Server

Official
by geneontology

add_entity_set

Adds an entity set of functionally interchangeable members to a GO-CAM model, validating and linking them with a substitutable entity relation. Atomic operation with rollback on failure.

Instructions

Add an entity set to a GO-CAM model with validated members.

Creates an entity set (CHEBI:33695 "information biomacromolecule" by default) representing functionally interchangeable entities. Links members using RO:0019003 (has substitutable entity) relation. The operation is atomic - either all members are added successfully or the entire operation is rolled back.

Args: model_id: The GO-CAM model identifier members: List of member dictionaries with keys: - entity_id (required): Entity ID (e.g., "UniProtKB:P12345") - label (optional): Member label for validation - evidence_type (optional): ECO code (e.g., "ECO:0000353") - reference (optional): Source reference (e.g., "PMID:12345678") assign_var: Variable name for the set (default: "set1")

Returns: Barista API response with set ID and member IDs

Examples: # Create a set of functionally equivalent kinases add_entity_set( "gomodel:12345", [ {"entity_id": "UniProtKB:P31749", "label": "AKT1"}, {"entity_id": "UniProtKB:P31751", "label": "AKT2"}, {"entity_id": "UniProtKB:Q9Y243", "label": "AKT3"} ], assign_var="akt_isoforms" )

# Create set with evidence
add_entity_set(
    "gomodel:12345",
    [
        {
            "entity_id": "UniProtKB:P04637",
            "label": "TP53",
            "evidence_type": "ECO:0000314",
            "reference": "PMID:87654321"
        },
        {
            "entity_id": "UniProtKB:P04049",
            "label": "RAF1",
            "evidence_type": "ECO:0000314",
            "reference": "PMID:87654321"
        }
    ],
)

Notes: - All members must have entity_id specified - Label validation prevents ID hallucination - Evidence and references are optional but recommended - Uses RO:0019003 (has substitutable entity) to link members - Atomic operation with automatic rollback on failure - Entity sets represent functionally interchangeable entities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_idYes
membersYes
assign_varNoset1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `add_entity_set` MCP tool handler function. Creates an entity set (CHEBI:33695) with validated members. Converts member dicts to EntitySetMember Pydantic models, calls client.add_entity_set(), and returns set ID and member count. Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def add_entity_set(
        model_id: str,
        members: List[Dict[str, Any]],
        assign_var: str = "set1"
    ) -> Dict[str, Any]:
        """
        Add an entity set to a GO-CAM model with validated members.
    
        Creates an entity set (CHEBI:33695 "information biomacromolecule" by default)
        representing functionally interchangeable entities. Links members using
        RO:0019003 (has substitutable entity) relation. The operation is atomic -
        either all members are added successfully or the entire operation is rolled back.
    
        Args:
            model_id: The GO-CAM model identifier
            members: List of member dictionaries with keys:
                    - entity_id (required): Entity ID (e.g., "UniProtKB:P12345")
                    - label (optional): Member label for validation
                    - evidence_type (optional): ECO code (e.g., "ECO:0000353")
                    - reference (optional): Source reference (e.g., "PMID:12345678")
            assign_var: Variable name for the set (default: "set1")
    
        Returns:
            Barista API response with set ID and member IDs
    
        Examples:
            # Create a set of functionally equivalent kinases
            add_entity_set(
                "gomodel:12345",
                [
                    {"entity_id": "UniProtKB:P31749", "label": "AKT1"},
                    {"entity_id": "UniProtKB:P31751", "label": "AKT2"},
                    {"entity_id": "UniProtKB:Q9Y243", "label": "AKT3"}
                ],
                assign_var="akt_isoforms"
            )
    
            # Create set with evidence
            add_entity_set(
                "gomodel:12345",
                [
                    {
                        "entity_id": "UniProtKB:P04637",
                        "label": "TP53",
                        "evidence_type": "ECO:0000314",
                        "reference": "PMID:87654321"
                    },
                    {
                        "entity_id": "UniProtKB:P04049",
                        "label": "RAF1",
                        "evidence_type": "ECO:0000314",
                        "reference": "PMID:87654321"
                    }
                ],
            )
    
        Notes:
            - All members must have entity_id specified
            - Label validation prevents ID hallucination
            - Evidence and references are optional but recommended
            - Uses RO:0019003 (has substitutable entity) to link members
            - Atomic operation with automatic rollback on failure
            - Entity sets represent functionally interchangeable entities
        """
        client = get_client()
    
        # Convert member dicts to Pydantic models
        try:
            pydantic_members = [EntitySetMember(**member) for member in members]
        except Exception as e:
            return {
                "success": False,
                "error": "Invalid member structure",
                "reason": str(e),
                "hint": "Each member must have 'entity_id' field. Optional: 'label', 'evidence_type', 'reference'"
            }
    
        # Call the new add_entity_set method
        resp = client.add_entity_set(
            model_id,
            pydantic_members,
            assign_var=assign_var,
        )
    
        if resp.validation_failed:
            return {
                "success": False,
                "error": "Validation failed",
                "reason": resp.validation_reason,
                "rolled_back": True,
                "member_count": len(members)
            }
    
        if resp.error:
            return {
                "success": False,
                "error": resp.error,
                "model_id": model_id,
            }
    
        # Get the set ID from model_vars or from the individuals list
        set_id = assign_var
        if resp.model_vars and assign_var in resp.model_vars:
            set_id = resp.model_vars[assign_var]
        elif resp.individuals and len(resp.individuals) > 0:
            # Find the set individual - it should be the first one created
            # Look for an entity set (typically CHEBI:33695 or similar)
            for ind in resp.individuals:
                if hasattr(ind, 'type') and any('CHEBI' in str(t.id) if hasattr(t, 'id') else False for t in ind.type):
                    set_id = ind.id
                    break
    
        return {
            "success": True,
            "set_id": set_id,
            "member_count": len(members),
            "assign_var": assign_var
        }
  • Input schema for add_entity_set: model_id (str), members (List[Dict] with entity_id, optional label/evidence_type/reference), assign_var (str, default 'set1').
    @mcp.tool()
    async def add_entity_set(
        model_id: str,
        members: List[Dict[str, Any]],
        assign_var: str = "set1"
    ) -> Dict[str, Any]:
  • Import of EntitySetMember from noctua.models, used to validate and convert member dicts in add_entity_set.
    from noctua.models import ProteinComplexComponent, EntitySetMember
  • Registration of add_entity_set as an MCP tool via the @mcp.tool() decorator on line 569.
    @mcp.tool()
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses atomicity, default CHEBI term, specific relation (RO:0019003), and validation. It does not mention side effects or permissions, but for a creation tool, it is adequately transparent.

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

Conciseness4/5

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

The description is well-structured with sections (overview, args, examples, notes) and front-loads the purpose. It is slightly lengthy but every sentence adds value. Minimal redundancy.

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

Completeness4/5

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

Given the lack of annotations and loose schema for members, the description is quite complete. It explains the return value (Barista API response with IDs) and provides examples. It covers all needed context for using the tool.

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

Parameters5/5

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

The input schema has 0% description coverage, so the description compensates fully. It details each parameter: model_id, members (with nested keys), and assign_var. Examples show exact usage patterns, adding significant meaning 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 tool's purpose: adding an entity set to a GO-CAM model with validated members. It specifies the action, resource, and key characteristics (atomic operation, RO relation), and differentiates from sibling tools like add_individual and add_protein_complex by emphasizing functionally interchangeable entities.

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

Usage Guidelines4/5

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

The description provides usage guidance through the 'Notes' section, including required fields, validation, and atomicity. Examples illustrate typical use cases. However, it does not explicitly state when NOT to use this tool or compare directly to alternatives.

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/geneontology/noctua-mcp'

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