Skip to main content
Glama
milliomics

millimap-mcp

Official
by milliomics

search_genes

Search marker genes by name (case-insensitive) to find which clusters they mark.

Instructions

Case-insensitive search across marker genes. Returns matching genes and which cluster they mark.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_genes` tool handler function. It loads the snapshot, does a case-insensitive substring search over marker genes, and returns matching genes with their cluster ID, annotation, score, and log2fc. Uses `_load_snapshot()` and `_fmt_json()` helpers, and is registered as an MCP tool via the `@mcp.tool()` decorator on line 191.
    @mcp.tool()
    def search_genes(query: str, limit: int = 20) -> str:
        """Case-insensitive search across marker genes. Returns matching genes and
        which cluster they mark.
        """
        snap = _load_snapshot()
        if "error" in snap:
            return _fmt_json(snap)
        needle = query.strip().lower()
        hits: list[dict] = []
        for cid, entries in snap.get("markers", {}).items():
            for entry in entries:
                gene = str(entry.get("gene", ""))
                if needle and needle in gene.lower():
                    hits.append({
                        "gene": gene,
                        "cluster_id": cid,
                        "annotation": snap.get("annotations", {}).get(cid),
                        "score": entry.get("score"),
                        "log2fc": entry.get("log2fc"),
                    })
                    if len(hits) >= max(1, min(limit, 100)):
                        break
            if len(hits) >= max(1, min(limit, 100)):
                break
        return _fmt_json({"query": query, "hits": hits})
  • The `@mcp.tool()` decorator on line 191 registers `search_genes` as an MCP tool via the FastMCP instance (`mcp = FastMCP("millimap")` on line 22).
    @mcp.tool()
  • `_load_snapshot()` helper function that reads the MilliMap session snapshot from `~/.millimap/mcp_session.json`. Called by `search_genes` to get marker gene data.
    def _load_snapshot() -> dict[str, Any]:
        if not SNAPSHOT_PATH.exists():
            return {
                "error": "no_snapshot",
                "message": (
                    f"No MilliMap snapshot found at {SNAPSHOT_PATH}. "
                    "Is MilliMap running with a dataset loaded?"
                ),
            }
        try:
            with SNAPSHOT_PATH.open("r") as f:
                return json.load(f)
        except Exception as exc:
            return {"error": "read_failed", "message": str(exc)}
  • `_fmt_json()` helper function that serializes a payload to pretty-printed JSON. Called by `search_genes` to format its return value.
    def _fmt_json(payload: Any) -> str:
        return json.dumps(payload, indent=2, default=str)
Behavior2/5

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

With no annotations provided, the description carries the full burden. It only mentions case-insensitivity and output structure, but does not disclose side effects, performance characteristics, or error handling.

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 very concise (one sentence) and front-loads the core purpose. However, it lacks any structural elements like bullet points or sections, which slightly reduces readability for complex scenarios.

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

Completeness3/5

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

Given the presence of an output schema, return values need not be detailed. However, the description does not explain limit behavior or result ordering, leaving a moderate gap for a search tool.

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

Parameters2/5

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

Schema description coverage is 0%, and the description provides only minimal context for 'query' and 'limit' beyond their names. It does not explain acceptable formats or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it performs a case-insensitive search across marker genes and returns matching genes with cluster information. It is specific enough to differentiate from siblings like 'find_markers' but does not explicitly name any alternative.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternative sibling tools. Missing explicit context about prerequisites or exclusions.

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/milliomics/millimap-mcp'

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