model_summary
Generate summary statistics for GO-CAM biological models including individual counts, fact counts, and predicate distribution analysis to assess model complexity and structure.
Instructions
Get a summary of a GO-CAM model including counts and key information.
Args: model_id: The GO-CAM model identifier
Returns: Summary with individual count, fact count, and predicate distribution
Examples: # Get summary of a model result = model_summary("gomodel:5fce9b7300001215") # Returns: # { # "model_id": "gomodel:5fce9b7300001215", # "state": "production", # "individual_count": 42, # "fact_count": 67, # "predicate_distribution": { # "RO:0002333": 15, # enabled_by (note: not in vetted list) # "RO:0002411": 8, # causally upstream of # "BFO:0000066": 12, # occurs_in # "BFO:0000050": 5 # part_of # } # }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes |
Input Schema (JSON Schema)
Implementation Reference
- src/noctua_mcp/mcp_server.py:1187-1268 (handler)The handler function for the 'model_summary' tool. It fetches the GO-CAM model using BaristaClient.get_model(), counts individuals and facts, computes predicate distribution, and returns a structured summary including model state.async def model_summary(model_id: str) -> Dict[str, Any]: """ Get a summary of a GO-CAM model including counts and key information. Args: model_id: The GO-CAM model identifier Returns: Summary with individual count, fact count, and predicate distribution Examples: # Get summary of a model result = model_summary("gomodel:5fce9b7300001215") # Returns: # { # "model_id": "gomodel:5fce9b7300001215", # "state": "production", # "individual_count": 42, # "fact_count": 67, # "predicate_distribution": { # "RO:0002333": 15, # enabled_by (note: not in vetted list) # "RO:0002411": 8, # causally upstream of # "BFO:0000066": 12, # occurs_in # "BFO:0000050": 5 # part_of # } # } # Check if a model is empty result = model_summary("gomodel:new_empty_model") if result["individual_count"] == 0: print("Model is empty") # Analyze model complexity result = model_summary("gomodel:12345") causal_edges = result["predicate_distribution"].get("RO:0002411", 0) causal_edges += result["predicate_distribution"].get("RO:0002413", 0) # provides input for causal_edges += result["predicate_distribution"].get("RO:0002629", 0) # directly positively regulates causal_edges += result["predicate_distribution"].get("RO:0002630", 0) # directly negatively regulates print(f"Model has {causal_edges} causal relationships") """ client = get_client() resp = client.get_model(model_id) if resp.validation_failed: return { "success": False, "error": "Validation failed", "reason": resp.validation_reason, "model_id": model_id } if resp.error: return { "success": False, "error": "Failed to retrieve model", "reason": resp.error, "model_id": model_id } # Extract summary information individuals = resp.individuals facts = resp.facts # Count predicates predicate_counts: Dict[str, int] = {} for fact in facts: # fact is now a Pydantic Fact object, not a dict pred = fact.property if hasattr(fact, 'property') else "unknown" predicate_counts[pred] = predicate_counts.get(pred, 0) + 1 # Get model state if available model_state = resp.model_state return { "success": True, "model_id": model_id, "state": model_state, "individual_count": len(individuals), "fact_count": len(facts), "predicate_distribution": predicate_counts, }