get_cluster_markers
Returns the top marker genes for a specific cell cluster. Provide the cluster identifier and optionally the number of top markers to retrieve.
Instructions
Return top marker genes for a specific cluster.
Args: cluster_id: Cluster identifier as a string (e.g., "0", "1", "CD8_T"). top_n: Number of top markers to return (default 10, max 15).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cluster_id | Yes | ||
| top_n | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/millimap_mcp/server.py:136-159 (handler)The tool handler function for get_cluster_markers. Decorated with @mcp.tool(). Loads the snapshot, looks up markers for the given cluster_id, and returns top_n markers (max 15) along with any cell-type annotation.
@mcp.tool() def get_cluster_markers(cluster_id: str, top_n: int = 10) -> str: """Return top marker genes for a specific cluster. Args: cluster_id: Cluster identifier as a string (e.g., "0", "1", "CD8_T"). top_n: Number of top markers to return (default 10, max 15). """ snap = _load_snapshot() if "error" in snap: return _fmt_json(snap) markers = snap.get("markers", {}).get(str(cluster_id)) if not markers: return _fmt_json({ "error": "not_found", "cluster_id": cluster_id, "available_clusters": sorted(snap.get("markers", {}).keys()), }) annotation = snap.get("annotations", {}).get(str(cluster_id)) return _fmt_json({ "cluster_id": cluster_id, "annotation": annotation, "markers": markers[: max(1, min(top_n, 15))], }) - src/millimap_mcp/server.py:136-136 (registration)The @mcp.tool() decorator registers get_cluster_markers as a tool on the FastMCP server instance.
@mcp.tool() - src/millimap_mcp/server.py:77-78 (helper)Helper function _load_snapshot() loads the MilliMap session JSON snapshot. Used by the handler to read cluster markers, annotations, etc.
def _fmt_json(payload: Any) -> str: return json.dumps(payload, indent=2, default=str) - src/millimap_mcp/server.py:77-78 (helper)Helper function _fmt_json() serializes a payload to pretty-printed JSON. Used by the handler to format the response.
def _fmt_json(payload: Any) -> str: return json.dumps(payload, indent=2, default=str)