Skip to main content
Glama
milliomics

millimap-mcp

Official
by milliomics

annotate_cluster

Assign a cell-type label to a cluster in a MilliMap session, recording the annotation in the session snapshot.

Instructions

Set a cell-type annotation on a cluster in the running MilliMap session.

The label appears in MilliMap's annotation panel and is written back to the session snapshot — use this when you've figured out what a cluster is.

Args: cluster_id: Cluster identifier as shown in MilliMap (e.g. "Cluster 3", "1"). label: Cell-type name (e.g. "CD8+ T cell", "fibroblast", "doublet").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idYes
labelYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function 'annotate_cluster' that proxies the call to the running MilliMap desktop app via HTTP POST. It takes cluster_id and label parameters and returns the result formatted as JSON.
    @mcp.tool()
    def annotate_cluster(cluster_id: str, label: str) -> str:
        """Set a cell-type annotation on a cluster in the running MilliMap session.
    
        The label appears in MilliMap's annotation panel and is written back to
        the session snapshot — use this when you've figured out what a cluster is.
    
        Args:
            cluster_id: Cluster identifier as shown in MilliMap (e.g. "Cluster 3", "1").
            label: Cell-type name (e.g. "CD8+ T cell", "fibroblast", "doublet").
        """
        return _fmt_json(_post_tool("annotate_cluster", {
            "cluster_id": cluster_id, "label": label,
        }))
  • The @mcp.tool() decorator registers this function as an MCP tool named 'annotate_cluster' with the FastMCP server.
    @mcp.tool()
  • The _post_tool helper function that sends the actual HTTP POST request to the MilliMap desktop app's tool endpoint. Used by annotate_cluster to proxy the tool call.
    def _post_tool(name: str, args: dict, timeout: float = 600.0) -> dict:
        ctrl = _load_control()
        if not ctrl or not ctrl.get("port"):
            return {
                "ok": False,
                "error": (
                    f"MilliMap control endpoint not found at {CONTROL_PATH}. "
                    "Make sure MilliMap is running with a dataset loaded."
                ),
            }
        host = ctrl.get("host", "127.0.0.1")
        port = int(ctrl["port"])
        url = f"http://{host}:{port}/tool"
        data = json.dumps({"name": name, "args": args}).encode("utf-8")
        req = urllib.request.Request(
            url, data=data,
            headers={"Content-Type": "application/json"},
            method="POST",
        )
        try:
            with urllib.request.urlopen(req, timeout=timeout) as resp:
                return json.loads(resp.read().decode("utf-8"))
        except urllib.error.URLError as exc:
            return {"ok": False, "error": f"connection failed: {exc.reason}"}
        except Exception as exc:
            return {"ok": False, "error": f"HTTP call failed: {exc}"}
  • The _fmt_json helper used by annotate_cluster to format the response dictionary as a pretty-printed JSON string.
    def _fmt_json(payload: Any) -> str:
        return json.dumps(payload, indent=2, default=str)
  • The input schema (parameters) for annotate_cluster defined in the docstring/function signature: cluster_id (string) and label (string).
    Args:
        cluster_id: Cluster identifier as shown in MilliMap (e.g. "Cluster 3", "1").
        label: Cell-type name (e.g. "CD8+ T cell", "fibroblast", "doublet").
    """
    return _fmt_json(_post_tool("annotate_cluster", {
        "cluster_id": cluster_id, "label": label,
    }))
Behavior4/5

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

The description discloses that the label is written back to the session snapshot, indicating a side effect. Although no annotations exist, this provides adequate transparency for a simple annotation tool.

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

Conciseness5/5

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

The description is concise, starting with the primary purpose, and each sentence is informative without redundancy.

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

Completeness5/5

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

For a tool with two simple string parameters, the description covers purpose, usage context, and parameter examples sufficiently, making it complete.

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

Parameters4/5

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

With 0% schema coverage, the description compensates by providing example values for both parameters (e.g., 'Cluster 3', 'CD8+ T cell'), adding meaningful context beyond the empty 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 action (set a cell-type annotation) and the resource (a cluster in a MilliMap session), distinguishing it from sibling tools like run_clustering or find_markers.

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 explicitly says 'use this when you've figured out what a cluster is,' providing clear context for when to use the tool, though it does not discuss when not to use it or 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/milliomics/millimap-mcp'

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