Skip to main content
Glama

box_ai_extract_structured_enhanced_using_template_tool

Extract structured data from Box files using AI and predefined templates for enhanced processing. Simplify data extraction by specifying file IDs and template keys to generate JSON output.

Instructions

Extract structured data from files in Box using AI with a specified template and enhanced processing. This tool allows users to extract structured data from files by using a predefined template, with enhanced processing capabilities. Args: ctx (Context): The context object containing the request and lifespan context. file_ids (List[str]): The IDs of the files to read. template_key (str): The ID of the template to use for extraction. Returns: dict: The extracted structured data in a json string format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idsYes
template_keyYes

Implementation Reference

  • The primary handler function implementing the core logic of the MCP tool. It retrieves the Box client from the context and calls the underlying Box AI extraction function with enhanced capabilities using a metadata template.
    async def box_ai_extract_structured_enhanced_using_template_tool( ctx: Context, file_ids: List[str], template_key: str, ) -> dict: """ Extract structured data from one or more files and return a SINGLE metadata instance (Enhanced version). This enhanced tool analyzes the provided file(s) and extracts information to populate a single metadata instance based on the specified template. When multiple files are provided, Box AI combines information from ALL files to create ONE complete metadata record. Enhanced features: - Uses advanced AI models (e.g., Google Gemini) for improved accuracy - Better handling of complex document layouts and image quality - More robust extraction for handwritten or low-quality scans Use cases: - Single file: Extract metadata from one receipt, invoice, or document - Multiple files: Combine data from multiple sources into one metadata instance (e.g., extract project info from a proposal PDF, budget spreadsheet, and timeline image) NOT for batch processing: If you need to extract metadata 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. template_key (str): The key of the metadata template to use for the extraction. Example: "insurance_policy_template". Returns: dict: The extracted structured data in a json string format. """ box_client = get_box_client(ctx) response = box_ai_extract_structured_enhanced_using_template( box_client, file_ids, template_key ) return response
  • The registration of the tool using the MCP decorator mcp.tool(), making it available in the MCP server.
    mcp.tool()(box_ai_extract_structured_enhanced_using_template_tool)
  • Import statement for the tool handler function from src/tools/box_tools_ai.py, required for registration.
    box_ai_extract_structured_enhanced_using_template_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