anndata_mcp.tools#
Submodules#
Package Contents#
- anndata_mcp.tools.get_descriptive_stats(path: Annotated[str, Field(description='Absolute path or URL to the AnnData file (.h5ad or .zarr)')], attribute: Annotated[Literal['X', 'obs', 'var', 'obsm', 'varm', 'obsp', 'varp', 'uns', 'layers'], Field(description='The attribute to describe')], key: Annotated[str | list[str] | None, Field(description="The key of the attribute value to explore. Can be a single string or a list of strings for nested key retrieval (e.g., ['key1', 'key2'] to access attr_obj['key1']['key2']). Should be None for attributes X, obs, and var.", default=None)] = None, columns_or_genes: Annotated[list[str] | None, Field(description="The columns or genes to describe. For pandas.DataFrame attributes (e.g., obs, var), these are column names. For 'X' or 'layers' attributes, these are gene names (from var_names). If None, the entire dataset is considered. Also accepts glob-like patterns as input, e.g. ['RE*', 'CD4*'].")] = None, return_value_counts_for_categorical: Annotated[bool, Field(description='Whether to return the value counts for categorical columns.')] = False, filter_attribute: Annotated[Literal['obs', 'var'], Field(description="The attribute to filter by. One of 'obs' or 'var' or None for no filtering. Has to be provided TOGETHER with filter_column, filter_operator, and filter_value.")] = None, filter_column: Annotated[str | None, Field(description='The column name of the obs or var dataframe to filter by.')] = None, filter_operator: Annotated[Literal['==', '!=', '>', '>=', '<', '<=', 'isin', 'notin'] | None, Field(description='The operator to use for the filter.')] = None, filter_value: Annotated[list[str | float | bool] | str | float | bool | None, Field(description='The value(s) to filter by.')] = None) ExplorationResult#
Provide basic descriptive statistics (e.g., count, mean, std, min, max, etc. or value counts) for an attribute or attribute value of an optionally filtered AnnData object.
- anndata_mcp.tools.get_summary(path: Annotated[str, Field(description='Absolute path or URL to the AnnData file (.h5ad or .zarr)')]) AnnDataSummary#
Get a summary of an AnnData object from a file or URL.
- anndata_mcp.tools.view_raw_data(path: Annotated[str, Field(description='Absolute path or URL to the AnnData file')], attribute: Annotated[Literal['X', 'obs', 'var', 'obsm', 'varm', 'obsp', 'varp', 'uns', 'layers'], Field(description='The attribute to view')], key: Annotated[str | list[str] | None, Field(description="The key of the attribute value to view. Can be a single string or a list of strings for nested key retrieval (e.g., ['key1', 'key2'] to access attr_obj['key1']['key2']).")] = None, columns_or_genes: Annotated[list[str] | None, Field(description="Column names or gene names to select. For pandas.DataFrame attributes (e.g., obs, var), these are column names. For 'X' or 'layers' attributes, these are gene names (from var_names) and are used instead of col_start_index/col_stop_index. If None, the entire attribute is considered or col_start_index/col_stop_index is used. Also accepts glob-like patterns as input, e.g. ['RE*', 'CD4*'].")] = None, row_start_index: Annotated[int, Field(description='The start index for the row slice. Only applied to attributes or attribute values with a suitable type.')] = 0, row_stop_index: Annotated[int, Field(description='The stop index for the row slice. Only applied to attributes or attribute values with a suitable type.')] = 5, col_start_index: Annotated[int, Field(description='The start index for the column slice. Only applied to attributes or attribute values with a suitable type.')] = 0, col_stop_index: Annotated[int, Field(description='The stop index for the column slice. Only applied to attributes or attribute values with a suitable type.')] = 5, filter_column: Annotated[str | None, Field(description='The column name of the dataframe to filter by. Only applicable when the selected attribute (or attribute value) is a dataframe. Must be provided TOGETHER with filter_operator and filter_value.')] = None, filter_operator: Annotated[Literal['==', '!=', '>', '>=', '<', '<=', 'isin', 'notin'] | None, Field(description='The operator to use for the dataframe filter.')] = None, filter_value: Annotated[list[str | float | bool] | str | float | bool | None, Field(description='The value(s) to filter the dataframe by.')] = None) DataView#
View the raw data of an AnnData object.