-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.json
More file actions
61 lines (61 loc) · 3.32 KB
/
plugin.json
File metadata and controls
61 lines (61 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
"id": "pdf_multifunction_plugin_001",
"code": "async function pdf_multifunction_plugin_001(params, context) {\n const YOUR_SERVER_URL = 'https://googlesheet-plugin.onrender.com'; // Use your live Render URL\n const { action, ...body } = params;\n let endpoint = '';\n\n switch (action) {\n case 'create':\n endpoint = '/generate-pdf';\n break;\n case 'read':\n endpoint = '/read-pdf';\n break;\n case 'edit':\n endpoint = '/edit-pdf';\n break;\n default:\n throw new Error('Invalid action. Use \"create\", \"read\", or \"edit\".');\n }\n\n try {\n const response = await fetch(`${YOUR_SERVER_URL}${endpoint}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body)\n });\n\n if (!response.ok) {\n const errorData = await response.json();\n throw new Error(`API Server Error: ${response.status} - ${errorData.error || 'Unknown error'}`);\n }\n\n return await response.json();\n } catch (error) {\n console.error(`Error calling the PDF server for action '${action}':`, error);\n throw new Error(`Failed to communicate with the PDF server: ${error.message}`);\n }\n}",
"icon": "https://cdn-icons-png.flaticon.com/512/888/888846.png",
"uuid": "e745f4f9-53c5-6b7d-b80f-79ff03d456f2",
"emoji": "📄",
"title": "PDF Multi-Tool (Server)",
"system": false,
"iconURL": "https://cdn-icons-png.flaticon.com/512/888/888846.png",
"disabled": false,
"openaiSpec": {
"name": "pdf_multifunction_plugin_001",
"parameters": {
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string",
"enum": [ "create", "read", "edit" ],
"description": "The operation to perform: 'create' a new PDF, 'read' text from an existing PDF, or 'edit' an existing PDF by adding text."
},
"content": {
"type": "string",
"description": "For 'create' action: The text content to write into the new PDF."
},
"filename": {
"type": "string",
"description": "For 'create' action: The desired filename for the new PDF (e.g., 'report.pdf')."
},
"base64Data": {
"type": "string",
"description": "For 'read' or 'edit' actions: The Base64 encoded string of the existing PDF file to process."
},
"textToAdd": {
"type": "string",
"description": "For 'edit' action: The new text to write onto the PDF."
},
"pageNumber": {
"type": "number",
"description": "For 'edit' action: The 1-based page number where the new text should be added."
},
"xPosition": {
"type": "number",
"description": "For 'edit' action: The horizontal distance (in points) from the left edge of the page to place the text. Defaults to 50."
},
"yPosition": {
"type": "number",
"description": "For 'edit' action: The vertical distance (in points) from the top edge of the page to place the text. Defaults to 50."
}
}
},
"description": "A powerful tool to create new PDFs from text, read the text content of existing PDFs, and write new text onto existing PDFs."
},
"outputType": "respond_to_ai",
"isServerPlugin": true,
"turnedOnByDefault": true,
"authenticationType": "AUTH_TYPE_NONE",
"implementationType": "javascript"
}