list_rois
Retrieve all regions of interest saved in the current MilliMap session.
Instructions
List all ROIs saved in the current MilliMap session.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_rois"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/millimap_mcp/server.py:219-222 (handler)The `list_rois` tool handler: decorated with @mcp.tool(), calls _load_snapshot() to read the MCP session file and returns the 'rois' array formatted as JSON via _fmt_json().
@mcp.tool() def list_rois() -> str: """List all ROIs saved in the current MilliMap session.""" return _fmt_json(_load_snapshot().get("rois", [])) - src/millimap_mcp/server.py:219-222 (registration)The `list_rois` tool is registered via the `@mcp.tool()` decorator on the `FastMCP` instance named `mcp`, defined at line 22.
@mcp.tool() def list_rois() -> str: """List all ROIs saved in the current MilliMap session.""" return _fmt_json(_load_snapshot().get("rois", [])) - src/millimap_mcp/server.py:61-74 (helper)The `_load_snapshot()` helper reads the MCP session JSON file (at ~/.millimap/mcp_session.json) and returns its contents as a dict. This is what `list_rois` calls to get the 'rois' array.
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)} - src/millimap_mcp/server.py:77-78 (helper)The `_fmt_json()` helper serializes a Python object to an indented JSON string, used to format the output of `list_rois`.
def _fmt_json(payload: Any) -> str: return json.dumps(payload, indent=2, default=str) - src/millimap_mcp/server.py:219-222 (schema)The `list_rois` tool takes no arguments (no input schema) and returns a string (JSON output). The shape comes from the snapshot's 'rois' key which is an array.
@mcp.tool() def list_rois() -> str: """List all ROIs saved in the current MilliMap session.""" return _fmt_json(_load_snapshot().get("rois", []))