create_sample
Register new laboratory samples in RSpace with metadata, quantity tracking, and automatic subsample aliquot creation for research inventory management.
Instructions
Creates a new sample in the inventory system
Usage: Register new samples with metadata and quantity tracking Subsamples: Automatically creates specified number of subsample aliquots Quantity: Tracks total amount with specified units (ml, mg, μl, etc.)
Returns: Created sample information including generated subsample IDs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| name | Yes | ||
| subsample_count | No | ||
| tags | No | ||
| total_quantity_unit | No | ml | |
| total_quantity_value | No |
Implementation Reference
- main.py:743-775 (handler)Core handler implementation for the 'create_sample' MCP tool. Processes tags and quantity parameters, then delegates to inv_cli.create_sample to create inventory samples with subsamples.@mcp.tool(tags={"rspace", "inventory", "samples"}) def create_sample( name: str, tags: List[str] = None, description: str = None, subsample_count: int = 1, total_quantity_value: float = None, total_quantity_unit: str = "ml" ) -> dict: """ Creates a new sample in the inventory system Usage: Register new samples with metadata and quantity tracking Subsamples: Automatically creates specified number of subsample aliquots Quantity: Tracks total amount with specified units (ml, mg, μl, etc.) Returns: Created sample information including generated subsample IDs """ tag_objects = i.gen_tags(tags) if tags else [] quantity = None if total_quantity_value: from rspace_client.inv import quantity_unit as qu unit = qu.QuantityUnit.of(total_quantity_unit) quantity = i.Quantity(total_quantity_value, unit) return inv_cli.create_sample( name=name, tags=tag_objects, description=description, subsample_count=subsample_count, total_quantity=quantity )
- main.py:743-743 (registration)MCP tool registration decorator for create_sample, automatically discovered by FastMCP framework on server startup.@mcp.tool(tags={"rspace", "inventory", "samples"})
- main.py:744-751 (schema)Input schema defined by function type hints and defaults for the create_sample tool.def create_sample( name: str, tags: List[str] = None, description: str = None, subsample_count: int = 1, total_quantity_value: float = None, total_quantity_unit: str = "ml" ) -> dict: