Skip to main content
Glama

box_docgen_create_batch_tool

Generate multiple documents from a Box Doc Gen template using specific data, saving them to a designated folder. Supports PDF or DOCX output formats.

Instructions

Create a new Box Doc Gen batch to generate documents from a template.

Args: client (BoxClient): Authenticated Box client. docgen_template_id (str): ID of the Doc Gen template. destination_folder_id (str): ID of the folder to save the generated document. document_generation_data (List[Dict[str, Any]]): Data for document generation. example: [ { "generated_file_name": "Image test", "user_input": { "order": { "id": "12305", "date": "18-08-2023", "products": [ { "id": 1, "name": "A4 Papers", "type": "non-fragile", "quantity": 100, "price": 29, "amount": 2900 }, ] } } }, ] output_type (str): Output file type (only, "pdf" or "docx").

Returns: dict[str, Any]: Response containing batch creation status and details. If successful, contains a message with batch ID. If an error occurs, contains an "error" key with the error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destination_folder_idYes
docgen_template_idYes
document_generation_dataYes
output_typeNopdf

Implementation Reference

  • The core handler function implementing the box_docgen_create_batch_tool. It takes template ID, folder ID, data list, and output type, gets a Box client, and calls the underlying box_docgen_create_batch function.
    async def box_docgen_create_batch_tool( ctx: Context, docgen_template_id: str, destination_folder_id: str, document_generation_data: list[dict[str, Any]], output_type: str = "pdf", ) -> dict[str, Any]: """ Create a new Box Doc Gen batch to generate documents from a template. Args: client (BoxClient): Authenticated Box client. docgen_template_id (str): ID of the Doc Gen template. destination_folder_id (str): ID of the folder to save the generated document. document_generation_data (List[Dict[str, Any]]): Data for document generation. example: [ { "generated_file_name": "Image test", "user_input": { "order": { "id": "12305", "date": "18-08-2023", "products": [ { "id": 1, "name": "A4 Papers", "type": "non-fragile", "quantity": 100, "price": 29, "amount": 2900 }, ] } } }, ] output_type (str): Output file type (only, "pdf" or "docx"). Returns: dict[str, Any]: Response containing batch creation status and details. If successful, contains a message with batch ID. If an error occurs, contains an "error" key with the error message. """ box_client = get_box_client(ctx) return box_docgen_create_batch( box_client, docgen_template_id=docgen_template_id, destination_folder_id=destination_folder_id, document_generation_data=document_generation_data, output_type=output_type, )
  • The registration function that registers box_docgen_create_batch_tool (and other docgen tools) with the MCP server using mcp.tool().
    def register_doc_gen_tools(mcp: FastMCP): mcp.tool()(box_docgen_create_batch_tool) mcp.tool()(box_docgen_get_job_by_id_tool) mcp.tool()(box_docgen_list_jobs_tool) mcp.tool()(box_docgen_list_jobs_by_batch_tool) mcp.tool()(box_docgen_template_create_tool) mcp.tool()(box_docgen_template_list_tool) # mcp.tool()(box_docgen_template_delete_tool) # very dangerous tool, use with caution mcp.tool()(box_docgen_template_get_by_id_tool) mcp.tool()(box_docgen_template_list_tags_tool) mcp.tool()(box_docgen_template_list_jobs_tool) mcp.tool()(box_docgen_template_get_by_name_tool) mcp.tool()(box_docgen_create_single_file_from_user_input_tool)
  • Import statement importing the box_docgen_create_batch_tool handler from src/tools/box_tools_docgen.py for registration.
    from tools.box_tools_docgen import ( box_docgen_create_batch_tool, box_docgen_create_single_file_from_user_input_tool, box_docgen_get_job_by_id_tool, box_docgen_list_jobs_by_batch_tool, box_docgen_list_jobs_tool, box_docgen_template_create_tool, box_docgen_template_get_by_id_tool, box_docgen_template_get_by_name_tool, box_docgen_template_list_jobs_tool, # box_docgen_template_delete_tool, # very dangerous tool, use with caution box_docgen_template_list_tags_tool, box_docgen_template_list_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