API reference#

This reference documents the Python entry point and the tools exposed by the scvi-tools MCP server. MCP clients discover these tools automatically.

Server#

scvi_tools_mcp.main.run_app() → None#

Run the scvi-tools MCP server over the standard I/O transport.

Model guidance#

scvi_tools_mcp.tools._model_guidance.get_model_overview(model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi']) → ModelGuidanceResult#

Get a detailed overview of a specific scvi-tools model.

Returns the model description, use cases, required inputs, outputs, advantages, limitations, and key citations. Call this after recommend_model to learn about a specific model before using it.

Args:

model_name: The scvi-tools model name in lowercase (e.g. ‘scvi’, ‘scanvi’, ‘totalvi’).

scvi_tools_mcp.tools._model_guidance.get_model_parameters(model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi']) → ModelGuidanceResult#

Get key initialization and training parameters for a scvi-tools model.

Returns the most important parameters for model.__init__() and model.train() with descriptions and recommended defaults. Call this when a user wants to customize model behavior beyond defaults.

Args:

model_name: The scvi-tools model name in lowercase (e.g. ‘scvi’, ‘totalvi’).

scvi_tools_mcp.tools._model_guidance.recommend_model(task: Literal['batch_integration', 'dimensionality_reduction', 'differential_expression', 'cell_type_annotation', 'deconvolution', 'spatial_mapping', 'chromatin_accessibility', 'multimodal_integration', 'reference_mapping', 'perturbation_modeling', 'spatial_denoising', 'niche_analysis', 'cell_communication', 'spatial_signature_scoring'], data_type: Literal['scrna', 'cite_seq', 'spatial', 'atac', 'multiome', 'cytometry', 'methylation'], has_protein: bool, has_accessibility: bool, n_batches: int) → ModelGuidanceResult#

Recommend scvi-tools models ranked by suitability for the user’s task and data type.

Call this first when a user describes what they want to do. Returns a ranked list of model names with a short rationale for each. Use get_model_overview to get details on any recommended model.

Spatial-specific tasks: spatial_denoising (segmentation / background correction), niche_analysis (cell microenvironment effects), cell_communication (ligand-receptor / metabolite interactions), spatial_signature_scoring (gene-signature scores and spatial autocorrelation).

Args:

task: The analysis goal (spatial-specific tasks are described above). data_type: The type of single-cell data. has_protein: True if the data includes protein (ADT) measurements. has_accessibility: True if the data includes chromatin accessibility (ATAC). n_batches: Number of batches/donors. Use 1 if data is from a single batch.

Data preparation#

scvi_tools_mcp.tools._data_prep.get_setup_anndata_guide(model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi']) → DataPrepResult#

Get the exact setup_anndata() call and data requirements for a scvi-tools model.

Returns the required and optional AnnData fields, the exact Python call to run before creating the model, and common mistakes to avoid. Always call this before showing a user how to instantiate a model.

Args:

model_name: The scvi-tools model name in lowercase (e.g. ‘scvi’, ‘totalvi’).

scvi_tools_mcp.tools._data_prep.validate_data_requirements(model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi'], obs_keys: list[str], var_keys: list[str], has_raw: bool) → DataPrepResult#

Check whether the user’s AnnData object meets the requirements for a model.

Pass the column names present in adata.obs and adata.var. Returns a pass/fail checklist with fix instructions for any failures. Use this when a user reports errors during setup_anndata or model initialization.

Args:

model_name: The scvi-tools model name in lowercase. obs_keys: List of column names in adata.obs (from list(adata.obs.columns)). var_keys: List of column names in adata.var (from list(adata.var.columns)). has_raw: Whether adata.raw is set (adata.raw is not None).

Tutorials#

scvi_tools_mcp.tools._tutorials.get_tutorial(tutorial_name: str, page: int = 1, page_size: int = 200) → TutorialResult#

Read the full content of a scvi-tools tutorial.

Returns the tutorial as Markdown with code cells as fenced blocks. Large tutorials are paginated — check total_pages and call again with page=2, 3, etc. if needed. Get tutorial names from list_tutorials.

Args:

tutorial_name: Tutorial path like ‘scrna/harmonization’ or ‘quick_start/api_overview’. page: Page number starting at 1. page_size: Lines per page (default 200).

scvi_tools_mcp.tools._tutorials.list_tutorials(category: Literal['scrna', 'multimodal', 'spatial', 'atac', 'hub', 'quick_start', 'cytometry', 'dev', 'r', 'use_cases', 'scbs', 'custom_dl'] | None = None) → TutorialResult#

List all available scvi-tools tutorials, optionally filtered by category.

Returns tutorial names and one-line descriptions. Use get_tutorial to read the full content of any tutorial. Tutorial names returned here can be passed directly to get_tutorial.

Args:
category: Filter by category. Pass None to list all. Options: scrna, multimodal,

spatial, atac, hub, quick_start, cytometry, dev, r, use_cases, scbs, custom_dl.

scvi_tools_mcp.tools._tutorials.search_tutorials(query: str) → TutorialResult#

Search tutorials by keyword and return matching excerpts.

Use this to find tutorials relevant to a user’s question. Returns tutorial names ranked by keyword relevance with a matching excerpt from each. Then use get_tutorial to read the full content.

Args:

query: Space-separated keywords (e.g. ‘batch integration totalvi reference mapping’).

scvi-tools API lookup#

scvi_tools_mcp.tools._api_reference.get_api_reference(symbol: str) → ApiResult#

Get the API reference (signature + docstring) for a scvi-tools or scviva-tools class or method.

Use this when a user asks about specific parameters, return types, or method behavior. Pass the class name or method name. Covers scvi-tools models and the scviva-tools spatial toolkit (ResolVI, scVIVA, DestVI, Harreman, VISION, …).

Args:
symbol: Class or method name. Examples: ‘SCVI’, ‘TOTALVI’, ‘SCANVI.setup_anndata’,

‘HARREMAN’, ‘VisionAnalysis.compute_signatures’.

scvi_tools_mcp.tools._api_reference.search_api(query: str) → ApiResult#

Search the scvi-tools API for classes and methods matching a query.

Returns matching symbols with short descriptions. Use get_api_reference to get full details on any result.

Args:

query: Keywords to search (e.g. ‘differential expression’, ‘latent representation’).

Hugging Face Hub#

scvi_tools_mcp.tools._hub.get_hub_model(model_id: str) → HubResult#

Get metadata and loading guidance for one scvi-tools Hugging Face Hub model.

Use this after list_hub_models or suggest_hub_models when a user needs details for a specific pretrained repo. The response includes the Hugging Face URL and files available in the repo, but it does not fetch or download those files.

Args:

model_id: Hugging Face model id, e.g. scvi-tools/heart-cell-atlas-scvi.

scvi_tools_mcp.tools._hub.list_hub_models(model_class: str | None = None, modality: str | None = None, tissue: str | None = None, annotated: bool | None = None, page: int = 1, page_size: int = 25) → HubResult#

List pretrained scvi-tools models from the bundled Hugging Face Hub snapshot.

Use this when a user asks what pretrained scvi-tools HubModels exist, or wants to filter the official scvi-tools Hugging Face organization by model class, modality, tissue, or annotation status. This tool does not call Hugging Face at runtime.

Args:

model_class: Optional class filter, e.g. SCVI, SCANVI, TOTALVI, CondSCVI, RNAStereoscope. modality: Optional modality filter, e.g. rna or protein. tissue: Optional tissue substring filter, e.g. lung or thymus. annotated: Optional annotation-status filter. page: Result page, starting at 1. page_size: Number of models per page.

scvi_tools_mcp.tools._hub.suggest_hub_models(task: Literal['reference_mapping', 'label_transfer', 'query_embedding', 'cite_seq', 'spatial_deconvolution', 'example_usage'], modality: str | None = None, tissue: str | None = None, require_annotated: bool = False, limit: int = 5) → HubResult#

Suggest pretrained scvi-tools HubModels for an analysis task.

Use this when a user wants an appropriate pretrained model from the official scvi-tools Hugging Face hub. Suggestions are metadata-based: verify biological compatibility, feature space, and model-card guidance before loading any model.

Args:

task: The intended use for the pretrained hub model. modality: Optional modality preference, e.g. rna or protein. tissue: Optional tissue preference, e.g. lung or heart. require_annotated: If true, only consider repos tagged annotated:True. limit: Maximum number of suggestions to return.

scviva-tools#

scvi_tools_mcp.tools._scviva.get_scviva_model(model_name: Literal['resolvi', 'destvi', 'scviva', 'gimvi', 'diagvi', 'stereoscope', 'tangram', 'harreman', 'vision'], page: int = 1, page_size: int = 200) → ScvivaResult#

Get the API reference and user guide for one scviva-tools model.

Some entries (e.g. diagvi, stereoscope) exceed a single page — check total_pages and call again with page=2, 3, etc. to read the rest, including the User Guide section.

Args:

model_name: One of resolvi, destvi, scviva, gimvi, diagvi, stereoscope, tangram, harreman, vision. page: Page number starting at 1. page_size: Lines per page (default 200).

scvi_tools_mcp.tools._scviva.get_scviva_tutorial(tutorial_name: str, page: int = 1, page_size: int = 200) → ScvivaResult#

Read the full content of a scviva-tools tutorial.

Args:

tutorial_name: Tutorial name from list_scviva_tutorials, e.g. ‘resolVI_tutorial’. page: Page number starting at 1. page_size: Lines per page (default 200).

scvi_tools_mcp.tools._scviva.list_scviva_models() → ScvivaResult#

List the spatial transcriptomics models exposed by the scviva-tools package.

scviva-tools is a companion spatial toolkit built on top of scvi-tools, unifying ResolVI, DestVI, scVIVA, GIMVI, DiagVI, Stereoscope, Tangram, Harreman, and VISION under one API. Use get_scviva_model for details on any model returned here.

scvi_tools_mcp.tools._scviva.list_scviva_tutorials() → ScvivaResult#

List available scviva-tools tutorials, converted from the package’s own notebooks.

scib-metrics#

scvi_tools_mcp.tools._scib_metrics.get_scib_metric(metric_name: str) → ScibMetricsResult#

Get the API reference for one scib-metrics metric function or benchmark class.

Args:
metric_name: A metric or orchestration entry, e.g. isolated_labels, ilisi_knn,

kbet, benchmarker, bioconservation, batchcorrection. Case-insensitive. Call list_scib_metrics() for the full set of valid names.

scvi_tools_mcp.tools._scib_metrics.get_scib_metrics_tutorial(tutorial_name: str, page: int = 1, page_size: int = 200) → ScibMetricsResult#

Read the full content of a scib-metrics tutorial.

Args:

tutorial_name: Tutorial name from list_scib_metrics_tutorials, e.g. ‘lung_example’. page: Page number starting at 1. page_size: Lines per page (default 200).

scvi_tools_mcp.tools._scib_metrics.list_scib_metrics() → ScibMetricsResult#

List the integration-benchmarking metrics and orchestration classes exposed by scib-metrics.

scib-metrics is an accelerated reimplementation of the scIB benchmarking suite, grouping 12 metric functions into bio-conservation and batch-correction categories, plus a Benchmarker/BioConservation/BatchCorrection orchestration layer. Use get_scib_metric for details on any entry returned here.

scvi_tools_mcp.tools._scib_metrics.list_scib_metrics_tutorials() → ScibMetricsResult#

List available scib-metrics tutorials, converted from the package’s own notebooks.

Workflows#

scvi_tools_mcp.tools._workflows.get_downstream_guide(model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi'], task: Literal['de', 'embedding', 'clustering', 'deconvolution', 'transfer_labels']) → WorkflowResult#

Get a guide and code snippet for downstream analysis after training a scvi-tools model.

Use this after a model is trained to show the user how to extract results. Common tasks: differential expression (de), latent embedding, clustering, deconvolution, and label transfer.

Args:

model_name: The trained scvi-tools model name. task: The downstream analysis task.

scvi_tools_mcp.tools._workflows.get_workflow_template(task: Literal['batch_integration', 'dimensionality_reduction', 'differential_expression', 'cell_type_annotation', 'deconvolution', 'spatial_mapping', 'chromatin_accessibility', 'multimodal_integration', 'reference_mapping', 'perturbation_modeling'], model_name: Literal['amortizedlda', 'autozi', 'cellassign', 'contrastivevi', 'cytovi', 'decipher', 'destvi', 'diagvi', 'gimvi', 'linearscvi', 'methylanvi', 'methylvi', 'mrvi', 'multivi', 'peakvi', 'poissonvi', 'resolvi', 'scanvi', 'scar', 'scbasset', 'scvi', 'scviva', 'solo', 'stereoscope', 'sysvi', 'tangram', 'totalanvi', 'totalvi', 'velovi'] | None = None) → WorkflowResult#

Get a complete, runnable code template for a scvi-tools analysis task.

Returns a step-by-step commented Python script the user can adapt to their data. The code is returned as a string — it is NOT executed. Always show the user this template after recommending a model.

Args:

task: The analysis task (e.g. ‘batch_integration’, ‘cell_type_annotation’). model_name: Optional specific model. If None, uses the recommended default for the task.

Troubleshooting#

scvi_tools_mcp.tools._troubleshooting.get_faq(topic: Literal['training', 'data_setup', 'gpu', 'saving_loading', 'convergence', 'batch_correction', 'memory']) → TroubleshootResult#

Get curated FAQ entries for common scvi-tools problems.

Combines knowledge from official docs, GitHub issues, and Discourse threads. Use this when a user reports an error or asks ‘why is X not working’.

Args:
topic: The problem area. Options: training, data_setup, gpu, saving_loading,

convergence, batch_correction, memory.

scvi_tools_mcp.tools._troubleshooting.search_knowledge(query: str) → TroubleshootResult#

Search all scvi-tools knowledge: models, tutorials, user guide, API, and community FAQ.

Use this tool when no other tool exactly matches the user’s question. Searches across all knowledge sources and returns ranked excerpts. Good for: ‘how do I do X’, ‘what is the difference between X and Y’, ‘I got error Z’.

Args:

query: Free-text question or keywords (e.g. ‘how to save a model’, ‘ELBO explanation’).