Skip to main content
Glama
milliomics

millimap-mcp

Official
by milliomics

score_gene_signature

Score a gene signature across all cells and add it as a new observation column. Apply published signatures like exhausted T cell markers or EMT genes to enable color-based visualization in MilliMap.

Instructions

Score a gene signature across all cells and add it as an obs column.

Use this to apply a published signature (e.g. exhausted T cell markers, EMT genes) to the dataset. The score becomes a colorable field in MilliMap.

Args: genes: List of gene symbols to score together. score_name: Name for the new obs column (default 'mcp_score').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genesYes
score_nameNomcp_score

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `score_gene_signature` tool handler function decorated with `@mcp.tool()`. It accepts a list of gene symbols and an optional score_name, then proxies the call to the MilliMap desktop app via `_post_tool`.
    @mcp.tool()
    def score_gene_signature(genes: list[str], score_name: str = "mcp_score") -> str:
        """Score a gene signature across all cells and add it as an obs column.
    
        Use this to apply a published signature (e.g. exhausted T cell markers,
        EMT genes) to the dataset. The score becomes a colorable field in MilliMap.
    
        Args:
            genes: List of gene symbols to score together.
            score_name: Name for the new obs column (default 'mcp_score').
        """
        return _fmt_json(_post_tool("score_gene_signature", {
            "genes": genes, "score_name": score_name,
        }))
  • The `@mcp.tool()` decorator on line 308 registers `score_gene_signature` as an MCP tool on the FastMCP server instance.
    @mcp.tool()
    def score_gene_signature(genes: list[str], score_name: str = "mcp_score") -> str:
        """Score a gene signature across all cells and add it as an obs column.
    
        Use this to apply a published signature (e.g. exhausted T cell markers,
        EMT genes) to the dataset. The score becomes a colorable field in MilliMap.
    
        Args:
            genes: List of gene symbols to score together.
            score_name: Name for the new obs column (default 'mcp_score').
        """
        return _fmt_json(_post_tool("score_gene_signature", {
            "genes": genes, "score_name": score_name,
        }))
  • The `score_gene_signature` handler calls `_post_tool` (defined at line 33) to send a POST request to the MilliMap desktop app's /tool endpoint with the tool name and args.
    return _fmt_json(_post_tool("score_gene_signature", {
        "genes": genes, "score_name": score_name,
    }))
  • The `_post_tool` helper function that sends the tool call to the MilliMap desktop HTTP server. It reads the control file for host/port, posts the tool name and args as JSON, and returns the response.
    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}"}
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It explains that the score becomes a colorable field in MilliMap and describes the parameters. However, it does not disclose side effects, permissions, or the scoring algorithm.

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 with three sentences plus parameter details. It is front-loaded with the main action and efficiently explains the tool without unnecessary text.

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

Completeness4/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, the description need not detail return values. It adequately covers purpose, usage, and parameters. The scoring algorithm is not explained, but that is acceptable for a tool that adds a column.

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 description coverage, the description adds meaning by explaining that 'genes' is a list of gene symbols and 'score_name' is the name for the new obs column with a default. This goes beyond the schema's type-only information.

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 tool scores a gene signature across all cells and adds it as an obs column. It uses specific verbs and resources, and distinguishes from siblings like annotate_cluster and 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 provides a clear use case ('apply a published signature') and gives examples (exhausted T cell markers, EMT genes). It does not explicitly mention when not to use or alternatives, but the context is sufficient.

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