Skip to main content
Glama

box_metadata_set_instance_on_file_tool

Assign metadata to a file using a specified template. Requires a template key, file ID, and metadata values. Updates file attributes for enhanced organization and retrieval.

Instructions

Set a metadata instance on a file.

Args: ctx (Context): The context object containing the request and lifespan context. template_key (str): The key of the metadata template. file_id (str): The ID of the file to set the metadata on. metadata (dict): The metadata to set. Example: {'test_field': 'Test Value', 'date_field': '2023-10-01T00:00:00.000Z', 'float_field': 3.14, 'enum_field': 'option1', 'multiselect_field': ['option1', 'option2']}

Returns: dict: The response from the Box API after setting the metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYes
metadataYes
template_keyYes

Implementation Reference

  • The main asynchronous handler function implementing the tool logic. It extracts the Box client from the MCP context and delegates to the box_ai_agents_toolkit's box_metadata_set_instance_on_file function to set metadata on a specified file.
    async def box_metadata_set_instance_on_file_tool( ctx: Context, template_key: str, file_id: str, metadata: dict, ) -> dict: """ Set a metadata template instance on a specific file. Args: client (BoxClient): An authenticated Box client. template_key (str): The key of the metadata template to set. file_id (str): The ID of the file to set the metadata on. metadata (Dict[str, Any]): The metadata instance to set, as a dictionary. Metadata example: {'test_field': 'Test Value', 'date_field': '2023-10-01T00:00:00.000Z', 'float_field': 3.14, 'enum_field': 'option1', 'multiselect_field': ['option1', 'option2']} Returns: dict: The response from the Box API after setting the metadata. """ box_client = get_box_client(ctx) return box_metadata_set_instance_on_file( box_client, template_key, file_id, metadata )
  • The registration function that decorates and registers the box_metadata_set_instance_on_file_tool (and other metadata tools) with the FastMCP server instance.
    def register_metadata_tools(mcp: FastMCP): mcp.tool()(box_metadata_template_create_tool) mcp.tool()(box_metadata_template_list_tool) mcp.tool()(box_metadata_template_get_by_key_tool) mcp.tool()(box_metadata_template_get_by_name_tool) mcp.tool()(box_metadata_set_instance_on_file_tool) mcp.tool()(box_metadata_get_instance_on_file_tool) mcp.tool()(box_metadata_update_instance_on_file_tool) mcp.tool()(box_metadata_delete_instance_on_file_tool)

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/box-community/mcp-server-box'

If you have feedback or need assistance with the MCP directory API, please join our Discord server