add_extra_fields_to_item
Extend inventory items with custom metadata fields for experiments or projects. Add text or numeric data to organize research information in RSpace.
Instructions
Adds custom metadata fields to inventory items
Usage: Extend items with experiment-specific or project-specific data Field format: [{"name": "Field Name", "type": "text|number", "content": "value"}] Types: 'text' for strings, 'number' for numeric values
Returns: Updated item with new custom fields
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_id | Yes | ||
| field_data | Yes |
Implementation Reference
- main.py:1131-1149 (handler)Handler function decorated with @mcp.tool for registration. Processes list of dicts into ExtraField objects and adds them to the inventory item via inv_cli.@mcp.tool(tags={"rspace", "inventory", "utility"}) def add_extra_fields_to_item(item_id: Union[int, str], field_data: List[dict]) -> dict: """ Adds custom metadata fields to inventory items Usage: Extend items with experiment-specific or project-specific data Field format: [{"name": "Field Name", "type": "text|number", "content": "value"}] Types: 'text' for strings, 'number' for numeric values Returns: Updated item with new custom fields """ extra_fields = [] for field in field_data: field_type = i.ExtraFieldType.TEXT if field.get('type', 'text').lower() == 'text' else i.ExtraFieldType.NUMBER ef = i.ExtraField(field['name'], field_type, field.get('content', '')) extra_fields.append(ef) return inv_cli.add_extra_fields(item_id, *extra_fields)
- main.py:1132-1141 (schema)Type hints and docstring define the input schema: item_id as int/str, field_data as List[dict] with name, type (text/number), content.def add_extra_fields_to_item(item_id: Union[int, str], field_data: List[dict]) -> dict: """ Adds custom metadata fields to inventory items Usage: Extend items with experiment-specific or project-specific data Field format: [{"name": "Field Name", "type": "text|number", "content": "value"}] Types: 'text' for strings, 'number' for numeric values Returns: Updated item with new custom fields """
- main.py:1131-1131 (registration)The @mcp.tool decorator automatically registers the tool with the MCP server.@mcp.tool(tags={"rspace", "inventory", "utility"})