Skip to main content
Glama

box_ai_extract_structured_using_fields_tool

Extract structured data from files using custom field definitions. Define fields dynamically to create a single data record from one or multiple documents without requiring pre-existing templates.

Instructions

Extract structured data from one or more files using custom fields and return a SINGLE data instance.

This tool analyzes the provided file(s) and extracts information based on custom field definitions you provide. When multiple files are provided, Box AI combines information from ALL files to create ONE complete data record.

Unlike template-based extraction, this tool allows you to define fields on-the-fly without creating a metadata template in Box first. This is useful for ad-hoc data extraction or when you need fields that don't match any existing template.

Use cases:

  • Single file: Extract custom fields from one document (e.g., extract "contract_value" and "signing_date" from a contract)

  • Multiple files: Combine data from multiple sources into one data instance (e.g., extract "total_project_cost" from both a proposal and budget document)

NOT for batch processing: If you need to extract data from multiple files as separate instances, call this tool once per file in a loop.

Args: ctx (Context): The context object containing the request and lifespan context. file_ids (List[str]): The IDs of the files to read. fields (List[dict[str, Any]]): The fields to extract from the files. example:[ { "type": "string", "key": "name", "displayName": "Name", "description": "Policyholder Name", }, { "type": "string", "key": "number", "displayName": "Number", "description": "Policy Number", }, { "type": "date", "key": "effectiveDate", "displayName": "Effective Date", "description": "Policy Effective Date", }, { "type": "enum", "key": "paymentTerms", "displayName": "Payment Terms", "description": "Frequency of payment per year", "options": [ {"key": "Monthly"}, {"key": "Quarterly"}, {"key": "Semiannual"}, {"key": "Annually"}, ], }, { "type": "multiSelect", "key": "coverageTypes", "displayName": "Coverage Types", "description": "Types of coverage for the policy", "prompt": "Look in the coverage type table and include all listed types.", "options": [ {"key": "Body Injury Liability"}, {"key": "Property Damage Liability"}, {"key": "Personal Damage Liability"}, {"key": "Collision"}, {"key": "Comprehensive"}, {"key": "Uninsured Motorist"}, {"key": "Something that does not exist"}, ], }, ]

ai_agent_id (Optional[str]): The ID of the AI agent to use for processing.

Returns: dict: The extracted structured data in a json string format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idsYes
fieldsYes
ai_agent_idNo

Other 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