create_fillable_forms
Add text fields and checkboxes to PDF documents to create interactive forms for data collection.
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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | 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 | Yes | 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 | No | File name for the generated output. (Optional) | |
| httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
| httppassword | No | HTTP auth password if required to access source url. (Optional) | |
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) |
Implementation Reference
- pdfco/mcp/tools/apis/form.py:91-149 (handler)The MCP tool handler function for 'create_fillable_forms', decorated with @mcp.tool. It defines the input schema via Pydantic Fields and implements the logic by preparing parameters and calling the fill_pdf_form_fields service function 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)
- pdfco/mcp/tools/apis/form.py:91-91 (registration)The @mcp.tool decorator registers the 'create_fillable_forms' tool.@mcp.tool(name="create_fillable_forms")
- pdfco/mcp/tools/apis/form.py:92-114 (schema)The function parameters define the input schema using Pydantic Field descriptions for MCP tool validation.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: