box_metadata_update_instance_on_file_tool
Update metadata on a file using its ID and template key. Specify metadata changes and optionally remove non-included data fields. Returns the Box API response.
Instructions
Update a metadata instance on a file.
Args: ctx (Context): The context object containing the request and lifespan context. file_id (str): The ID of the file to update the metadata on. template_key (str): The key of the metadata template. metadata (dict): The metadata to update. remove_non_included_data (bool): If True, remove data from fields not included in the metadata.
Returns: dict: The response from the Box API after updating the metadata.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | ||
| metadata | Yes | ||
| remove_non_included_data | No | ||
| template_key | Yes |
Implementation Reference
- src/tools/box_tools_metadata.py:175-202 (handler)The primary handler function implementing the tool logic. It retrieves the Box client from context and calls the underlying box_ai_agents_toolkit.box_metadata_update_instance_on_file to perform the metadata update on the specified file.async def box_metadata_update_instance_on_file_tool( ctx: Context, file_id: str, template_key: str, metadata: dict, remove_non_included_data: bool = False, ) -> dict: """ Update the metadata template instance associated with a specific file. Args: ctx (Context): The context object containing the request and lifespan context. file_id (str): The ID of the file to update the metadata on. template_key (str): The key of the metadata template. metadata (dict): The metadata to update. remove_non_included_data (bool): If True, remove data from fields not included in the metadata. Returns: dict: The response from the Box API after updating the metadata. """ box_client = get_box_client(ctx) return box_metadata_update_instance_on_file( box_client, file_id, template_key, metadata, remove_non_included_data=remove_non_included_data, )
- src/tool_registry/metadata_tools.py:22-22 (registration)The registration of the tool using the MCP FastMCP mcp.tool() decorator in the metadata tools registry.mcp.tool()(box_metadata_update_instance_on_file_tool)