Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

create_fillable_forms

Convert PDFs into fillable forms by adding interactive fields like textboxes and checkboxes. Define field properties such as position, size, and type for customized form creation.

Instructions

Create new fillable form elements in a PDF document. Example annotations format: [ { "text": "prefilled text", "x": 10, "y": 30, "size": 12, "pages": "0-", "type": "TextField", "id": "textfield1" }, { "x": 100, "y": 150, "size": 12, "pages": "0-", "type": "Checkbox", "id": "checkbox1" } ] Ref: https://developer.pdf.co/api-reference/pdf-add#create-fillable-pdf-forms.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
annotationsYesList of form annotations to create. Each annotation can be a textfield or checkbox with properties like 'x', 'y', 'size', 'pages', 'type', and 'id'.
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
httpusernameNoHTTP auth user name if required to access source url. (Optional)
nameNoFile name for the generated output. (Optional)
urlYesURL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.

Implementation Reference

  • Handler function for the create_fillable_forms tool. It defines the tool schema via Pydantic Fields, validates inputs, constructs ConversionParams, and calls the fill_pdf_form_fields helper with annotations.
    @mcp.tool(name="create_fillable_forms") async def create_fillable_forms( url: str = Field( description="URL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files." ), annotations: list = Field( description="List of form annotations to create. Each annotation can be a textfield or checkbox with properties like 'x', 'y', 'size', 'pages', 'type', and 'id'." ), name: str = Field( description="File name for the generated output. (Optional)", default="" ), httpusername: str = Field( description="HTTP auth user name if required to access source url. (Optional)", default="", ), httppassword: str = Field( description="HTTP auth password if required to access source url. (Optional)", default="", ), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse: """ Create new fillable form elements in a PDF document. Example annotations format: [ { "text": "prefilled text", "x": 10, "y": 30, "size": 12, "pages": "0-", "type": "TextField", "id": "textfield1" }, { "x": 100, "y": 150, "size": 12, "pages": "0-", "type": "Checkbox", "id": "checkbox1" } ] Ref: https://developer.pdf.co/api-reference/pdf-add#create-fillable-pdf-forms.md """ params = ConversionParams( url=url, httpusername=httpusername, httppassword=httppassword, name=name, ) return await fill_pdf_form_fields(params, annotations=annotations, api_key=api_key)
  • Registration of the create_fillable_forms tool using the @mcp.tool decorator specifying the tool name.
    @mcp.tool(name="create_fillable_forms")
  • Helper function that implements the core logic for filling PDF forms or creating fillable forms by sending annotations or fields to the 'pdf/edit/add' API endpoint via the request function.
    async def fill_pdf_form_fields( params: ConversionParams, fields: list | None = None, annotations: list | None = None, api_key: str | None = None, ) -> BaseResponse: custom_payload = {} if fields: custom_payload["fields"] = fields if annotations: custom_payload["annotations"] = annotations return await request( "pdf/edit/add", params, custom_payload=custom_payload, api_key=api_key )

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/pdfdotco/pdfco-mcp'

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