find_markers
Identifies marker genes for each cluster by running rank_genes_groups, updating the MilliMap snapshot with top markers for subsequent retrieval.
Instructions
Run rank_genes_groups in MilliMap to find marker genes per cluster.
After this completes, the MilliMap snapshot refreshes with the top markers per cluster — subsequent calls to get_cluster_markers or genes_for_cell_type will see them.
Args: groupby: obs column to group by. Default 'clusters'. method: 'wilcoxon' (default), 't-test', or 'logreg'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groupby | No | clusters | |
| method | No | wilcoxon |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/millimap_mcp/server.py:275-289 (handler)The `find_markers` tool registered with `@mcp.tool()`. Delegates to the MilliMap desktop app by POSTing to its /tool endpoint with name='find_markers' and the groupby/method arguments.
@mcp.tool() def find_markers(groupby: str = "clusters", method: str = "wilcoxon") -> str: """Run rank_genes_groups in MilliMap to find marker genes per cluster. After this completes, the MilliMap snapshot refreshes with the top markers per cluster — subsequent calls to get_cluster_markers or genes_for_cell_type will see them. Args: groupby: obs column to group by. Default 'clusters'. method: 'wilcoxon' (default), 't-test', or 'logreg'. """ return _fmt_json(_post_tool("find_markers", { "groupby": groupby, "method": method, })) - src/millimap_mcp/server.py:33-58 (helper)Helper function that sends the tool request to the MilliMap desktop app's HTTP endpoint. Used by `find_markers` and all other write-path tools.
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}"} - src/millimap_mcp/server.py:77-78 (helper)Helper that formats the response dict as a pretty-printed JSON string. Used by `find_markers` to return its result.
def _fmt_json(payload: Any) -> str: return json.dumps(payload, indent=2, default=str) - src/millimap_mcp/server.py:275-276 (registration)The `@mcp.tool()` decorator registers `find_markers` as an MCP tool on the FastMCP server instance.
@mcp.tool() def find_markers(groupby: str = "clusters", method: str = "wilcoxon") -> str: