check_gene
Verify the presence of genes in adata.var_names to ensure accurate gene expression visualizations and color-coding in single-cell RNA sequencing analysis.
Instructions
Check if genes exist in adata.var_names. This tool should be called before gene expression visualizations or color by genes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| var_names | No | gene names. |
Implementation Reference
- src/scmcp/tool/util.py:80-82 (handler)The core handler function implementing the check_gene tool logic. It checks if each provided gene name exists in the AnnData object's var_names and returns a dictionary mapping gene to boolean existence.def check_gene(adata, var_names): return {v: v in adata.var_names for v in var_names}
- src/scmcp/schema/util.py:45-51 (schema)Pydantic model defining the input schema for check_gene tool, requiring a list of var_names (gene names). Used in the tool's inputSchema.class VarNamesModel(JSONParsingModel): """ListObsModel""" var_names: List[str] = Field( default=None, description="gene names." )
- src/scmcp/tool/util.py:34-38 (registration)MCP Tool registration defining the check_gene tool with name, description, and input schema reference.check_gene_tool = types.Tool( name="check_gene", description="Check if genes exist in adata.var_names. This tool should be called before gene expression visualizations or color by genes.", inputSchema=VarNamesModel.model_json_schema(), )
- src/scmcp/tool/util.py:90-96 (registration)Registration of the handler function in the util_func dictionary, used by run_util_func to dispatch tool calls to the implementation.util_func = { "mark_var": mark_var, "list_var": list_var, "list_obs": list_obs, "check_gene": check_gene, "merge_adata": merge_adata, }
- src/scmcp/tool/util.py:98-104 (registration)Registration of the Tool object in util_tools dictionary, exposed via tool/__init__.py for higher-level MCP server integration.util_tools = { "mark_var": mark_var_tool, "list_var": list_var_tool, "list_obs": list_obs_tool, "check_gene": check_gene_tool, "merge_adata": merge_adata_tool, }