Knowledge Graph Tools¶
Overview¶
16 unified query tools exposed through three interfaces — CLI, MCP, and LangChain agent — all backed by a single ToolRegistry. Adding a new tool means writing one function and registering it; all interfaces pick it up automatically.
Architecture¶
ToolDefinition(name, function, description, params)
│
ToolRegistry (single source of truth)
┌──────────────────┐
│ register() │
│ get_tool() │
│ get_all_tools() │
└──────┬───────────┘
│
┌─────┼──────┐
▼ ▼ ▼
CLI MCP LangChain Agent
CLI Usage¶
# Top biomarkers for a disease
uv run python -m src.kg_tools.cli get_top_biomarkers --disease "cardiovascular disease" --limit 5
# Fuzzy entity search
uv run python -m src.kg_tools.cli search_entities --query TP53 --entity_type protein
# Human-readable output
uv run python -m src.kg_tools.cli --human get_protein_interactions --protein TP53
# Raw Cypher (read-only)
uv run python -m src.kg_tools.cli run_cypher_query --query "MATCH (p:Protein) RETURN p.name LIMIT 5"
MCP Server¶
Exposes tools to AI assistants (Claude, VS Code, Kiro) via FastMCP:
{
"mcpServers": {
"olink-rag": {
"command": "uv",
"args": ["run", "python", "-m", "src.mcp_server.server"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "neo4j",
"NEO4J_PASSWORD": "your_password"
}
}
}
}
LangChain Agent Interface¶
from src.kg_tools.registry import ToolRegistry
from src.kg_tools.tools import register_all
from src.kg_tools.agent_adapter import get_agent_tools
registry = ToolRegistry()
register_all(registry)
tools = get_agent_tools(registry, db) # All 16 tools
tools = get_agent_tools(registry, db, groups=["biomarker", "evidence"]) # Filtered
Tool Groups¶
| Group | Tools |
|---|---|
biomarker |
get_top_biomarkers, get_disease_proteins, get_evidence_for_association, search_entities |
protein |
get_protein_details, get_protein_interactions, get_protein_pathways, get_shared_diseases |
disease |
get_disease_hierarchy, get_disease_proteins, get_shared_proteins, search_entities |
pathway |
get_protein_pathways, get_pathway_members, search_entities |
evidence |
get_evidence_for_association, get_relationship_evidence_depth, search_entities |
exploration |
search_entities, get_entity_disambiguation, get_graph_statistics, get_community_summary, run_cypher_query |
Performance¶
All 16 tool definitions fit in 713 tokens — no need for dynamic tool subsetting. MCP wrapper adds <0.001ms overhead vs direct call. CLI adds ~10ms from argparse.
See KG Tools Guide for full tool reference with schemas, and Benchmark Report for detailed performance data.