@formio/uag 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/template.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare enum ResponseTemplate {
|
|
|
18
18
|
formNotFound = "formNotFound",
|
|
19
19
|
noSubmissionsFound = "noSubmissionsFound",
|
|
20
20
|
submissionsFound = "submissionsFound",
|
|
21
|
+
submissionCount = "submissionCount",
|
|
21
22
|
submissionSearchError = "submissionSearchError",
|
|
22
23
|
submissionNotFound = "submissionNotFound",
|
|
23
24
|
updateNotConfirmed = "updateNotConfirmed",
|
package/lib/template.js
CHANGED
|
@@ -56,6 +56,7 @@ var ResponseTemplate;
|
|
|
56
56
|
ResponseTemplate["formNotFound"] = "formNotFound";
|
|
57
57
|
ResponseTemplate["noSubmissionsFound"] = "noSubmissionsFound";
|
|
58
58
|
ResponseTemplate["submissionsFound"] = "submissionsFound";
|
|
59
|
+
ResponseTemplate["submissionCount"] = "submissionCount";
|
|
59
60
|
ResponseTemplate["submissionSearchError"] = "submissionSearchError";
|
|
60
61
|
ResponseTemplate["submissionNotFound"] = "submissionNotFound";
|
|
61
62
|
ResponseTemplate["updateNotConfirmed"] = "updateNotConfirmed";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
There are **<%= submissionCount %>** total submissions within the <%= form.title %> form.
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
Found
|
|
2
|
-
|
|
1
|
+
Found **<%= submissions.length %>** out of **<%= submissionCount %>** total submissions for <%= form.title %> matching the query "<%= searchQuery %>":
|
|
3
2
|
<% submissions.forEach(function(submission, index) { %>
|
|
4
3
|
**Submission <%= index + 1 %>**
|
|
5
|
-
- **ID:** <%= submission._id %>
|
|
6
|
-
- **Requested Data:**
|
|
4
|
+
- **ID:** <%= submission._id %>
|
|
5
|
+
- **Requested Data:**
|
|
7
6
|
<% submission.data.forEach(function(field) { %>
|
|
8
7
|
- <%= field.path %>: <%= field.value %>
|
|
9
|
-
<% }); %>
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **Updated:** <%= submission.modified %>
|
|
13
|
-
<% }); %>
|
|
8
|
+
<% }); %> - **Partial ID (submission_id_partial):** <%= submission.partialId %>
|
|
9
|
+
- **Created:** <%= submission.created %>
|
|
10
|
+
- **Updated:** <%= submission.modified %><% }); %>
|
|
14
11
|
<% if (submissions.length > 1) { %>
|
|
15
12
|
**Multiple submissions found. To proceed:**
|
|
16
13
|
1. **Be more specific** in your search query to find just one record, OR
|
|
@@ -18,8 +15,5 @@ Found <%= resultCount %> submissions for <%= form.title %> matching "<%= searchQ
|
|
|
18
15
|
|
|
19
16
|
Example: "Update the submission ending in **abc1**" or use `find_submissions` with `submission_id_partial: "abc1"`
|
|
20
17
|
|
|
21
|
-
**Note:** All <%= fieldUpdates.length %> field update(s) will be applied to whichever submission you select.
|
|
22
|
-
<% } else { %>
|
|
23
|
-
|
|
24
18
|
Use the `confirm_submission_update` tool with the submission_id set to the full submission ID to submit the data.
|
|
25
19
|
<% } %>
|
|
@@ -118,7 +118,7 @@ class SchemaBuilder {
|
|
|
118
118
|
'less_than_equal'
|
|
119
119
|
]).optional().default('contains').describe('The operator to use for matching. "equals" for exact match, "contains" for substring match, "starts_with" or "ends_with" for prefix/suffix match, "regex" for regular expression match, "greater_than" or "less_than" only for numeric values, "in" if searching for multiple values as comma-separated values, "nin" if excluding multiple values as comma-separated values.'),
|
|
120
120
|
search_value: zod_1.default.string().describe('The value of the field to use when searching.')
|
|
121
|
-
}).describe('Object containing the `data_path` and search value. Use `get_form_fields` to get all the field information to populate this search query object.')).describe('Array of search criteria to find matching submissions. All criteria must match (AND logic).');
|
|
121
|
+
}).describe('Object containing the `data_path` and search value. Use `get_form_fields` to get all the field information to populate this search query object.')).optional().describe('Array of search criteria to find matching submissions. All criteria must match (AND logic). Do not provide this parameter to get the total count of submissions without retrieving the submission details.');
|
|
122
122
|
return this;
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
@@ -9,7 +9,7 @@ const findSubmission = async (project) => {
|
|
|
9
9
|
return (0, lodash_1.defaultsDeep)(project.config?.toolOverrides?.find_submissions || {}, {
|
|
10
10
|
name: 'find_submissions',
|
|
11
11
|
title: 'Find submissions within a form',
|
|
12
|
-
description: 'Find existing form submissions based on field values (search query). Use this to search for people, records, or data by name, email, phone, position, company, or other field values. Examples: find a contact by name, find someone who works at a company, find records with specific criteria.',
|
|
12
|
+
description: 'Find existing form submissions based on field values (search query). Use this to search for people, records, or data by name, email, phone, position, company, or other field values. Examples: find a contact by name, find someone who works at a company, find records with specific criteria. To retrieve the total count of records within a form, use this tool without providing a `search_query`.',
|
|
13
13
|
inputSchema: (new SchemaBuilder_1.SchemaBuilder(project))
|
|
14
14
|
.form_name()
|
|
15
15
|
.search_query()
|
|
@@ -22,8 +22,9 @@ const findSubmission = async (project) => {
|
|
|
22
22
|
if (!form) {
|
|
23
23
|
return project.mcpResponse(template_1.ResponseTemplate.formNotFound, { formName: form_name }, true);
|
|
24
24
|
}
|
|
25
|
+
search_query = search_query || [];
|
|
25
26
|
const query = {};
|
|
26
|
-
if (!submission_id) {
|
|
27
|
+
if (!submission_id && search_query.length > 0) {
|
|
27
28
|
for (const criterion of search_query) {
|
|
28
29
|
if (!criterion.data_path || !criterion.search_value) {
|
|
29
30
|
return project.mcpResponse(template_1.ResponseTemplate.submissionSearchError, {
|
|
@@ -80,17 +81,29 @@ const findSubmission = async (project) => {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
try {
|
|
84
|
+
let submissionCount = 0;
|
|
83
85
|
let submissions = [];
|
|
84
86
|
if (submission_id) {
|
|
85
87
|
const result = await form.loadSubmission(submission_id, extra.authInfo);
|
|
86
88
|
if (result) {
|
|
87
89
|
submissions = [result];
|
|
90
|
+
submissionCount = 1;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
else {
|
|
91
94
|
query.limit = ((0, lodash_1.isNumber)(limit) && limit > 0) ? limit : 10;
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
if (search_query.length > 0) {
|
|
96
|
+
const result = await form.find(query, extra.authInfo);
|
|
97
|
+
submissions = result.items;
|
|
98
|
+
submissionCount = result.count;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
submissionCount = await form.count({}, extra.authInfo);
|
|
102
|
+
return project.mcpResponse(template_1.ResponseTemplate.submissionCount, {
|
|
103
|
+
form: form.form,
|
|
104
|
+
submissionCount
|
|
105
|
+
});
|
|
106
|
+
}
|
|
94
107
|
}
|
|
95
108
|
if (!submissions || submissions.length === 0) {
|
|
96
109
|
return project.mcpResponse(template_1.ResponseTemplate.noSubmissionsFound, {
|
|
@@ -139,6 +152,7 @@ const findSubmission = async (project) => {
|
|
|
139
152
|
return project.mcpResponse(template_1.ResponseTemplate.submissionsFound, {
|
|
140
153
|
form: form.form,
|
|
141
154
|
searchQuery: JSON.stringify(search_query),
|
|
155
|
+
submissionCount,
|
|
142
156
|
submissions: submissions.map(sub => {
|
|
143
157
|
return {
|
|
144
158
|
_id: sub._id,
|
|
@@ -147,8 +161,7 @@ const findSubmission = async (project) => {
|
|
|
147
161
|
data: getFieldValues(sub),
|
|
148
162
|
partialId: sub._id ? sub._id.toString().slice(-4) : 'N/A'
|
|
149
163
|
};
|
|
150
|
-
})
|
|
151
|
-
resultCount: submissions.length
|
|
164
|
+
})
|
|
152
165
|
});
|
|
153
166
|
}
|
|
154
167
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/uag",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "The Form.io Universal Agent Gateway (UAG).",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build:ts": "npx tsc",
|
|
16
16
|
"build:copy-templates": "mkdir -p lib/templates && cp src/templates/*.md lib/templates/",
|
|
17
17
|
"build": "npm run clean && npm run build:ts && npm run build:copy-templates",
|
|
18
|
-
"build:docker": "
|
|
18
|
+
"build:docker": "docker build -t formio/uag$(node -p \"require('./package.json').version.includes('-rc.') ? ':rc' : ''\") --platform=linux/amd64 .",
|
|
19
19
|
"test": "TS_NODE_PROJECT=tsconfig.test.json mocha --no-node-snapshot",
|
|
20
20
|
"dev": "tsx --no-node-snapshot index.js",
|
|
21
21
|
"start": "node --no-node-snapshot index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"author": "",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@formio/appserver": "^2.12.
|
|
27
|
+
"@formio/appserver": "^2.12.2",
|
|
28
28
|
"@formio/core": "2.5.1-dev.291.6557e4e",
|
|
29
|
-
"@modelcontextprotocol/sdk": "1.27.
|
|
29
|
+
"@modelcontextprotocol/sdk": "1.27.1",
|
|
30
30
|
"cors": "^2.8.6",
|
|
31
31
|
"debug": "^4.4.3",
|
|
32
32
|
"dotenv": "^17.3.1",
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
"node-html-markdown": "^2.0.0",
|
|
38
38
|
"zod": "^4.3.6"
|
|
39
39
|
},
|
|
40
|
+
"resolutions": {
|
|
41
|
+
"tar": ">=7.5.7",
|
|
42
|
+
"minimatch": ">=10.2.1",
|
|
43
|
+
"brace-expansion": ">=5.0.1",
|
|
44
|
+
"diff": ">=8.0.3"
|
|
45
|
+
},
|
|
40
46
|
"devDependencies": {
|
|
41
47
|
"@types/chai": "^5.2.3",
|
|
42
48
|
"@types/cors": "^2.8.19",
|
|
@@ -44,10 +50,10 @@
|
|
|
44
50
|
"@types/dotenv": "^8.2.3",
|
|
45
51
|
"@types/express": "^5.0.6",
|
|
46
52
|
"@types/jsonwebtoken": "^9.0.10",
|
|
47
|
-
"@types/lodash": "^4.17.
|
|
53
|
+
"@types/lodash": "^4.17.24",
|
|
48
54
|
"@types/mocha": "^10.0.10",
|
|
49
|
-
"@types/node": "^25.3.
|
|
50
|
-
"@types/supertest": "^
|
|
55
|
+
"@types/node": "^25.3.2",
|
|
56
|
+
"@types/supertest": "^7.2.0",
|
|
51
57
|
"chai": "^6.2.2",
|
|
52
58
|
"mocha": "^11.7.5",
|
|
53
59
|
"supertest": "^7.2.2",
|