@cplace/test-mcp-server 0.1.9 → 0.1.10
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/README.md +23 -1
- package/dist/api.d.ts +2 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -1
- package/dist/api.js.map +1 -1
- package/dist/index.js +18 -1130
- package/dist/index.js.map +1 -1
- package/dist/tools/common-schemas.d.ts +228 -0
- package/dist/tools/common-schemas.d.ts.map +1 -0
- package/dist/tools/common-schemas.js +68 -0
- package/dist/tools/common-schemas.js.map +1 -0
- package/dist/tools/pages.d.ts +4 -0
- package/dist/tools/pages.d.ts.map +1 -0
- package/dist/tools/pages.js +198 -0
- package/dist/tools/pages.js.map +1 -0
- package/dist/tools/references.d.ts +4 -0
- package/dist/tools/references.d.ts.map +1 -0
- package/dist/tools/references.js +57 -0
- package/dist/tools/references.js.map +1 -0
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +304 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/system.d.ts +3 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +22 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/type-layouts.d.ts +4 -0
- package/dist/tools/type-layouts.d.ts.map +1 -0
- package/dist/tools/type-layouts.js +56 -0
- package/dist/tools/type-layouts.js.map +1 -0
- package/dist/tools/users.d.ts +4 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +62 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/version-history.d.ts +4 -0
- package/dist/tools/version-history.d.ts.map +1 -0
- package/dist/tools/version-history.js +142 -0
- package/dist/tools/version-history.js.map +1 -0
- package/dist/tools/widgets.d.ts +4 -0
- package/dist/tools/widgets.d.ts.map +1 -0
- package/dist/tools/widgets.js +516 -0
- package/dist/tools/widgets.js.map +1 -0
- package/dist/tools/workspace.d.ts +4 -0
- package/dist/tools/workspace.d.ts.map +1 -0
- package/dist/tools/workspace.js +118 -0
- package/dist/tools/workspace.js.map +1 -0
- package/dist/types.d.ts +2 -22
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -9
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +14 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +66 -12
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { debugLogWithTag } from "../logger.js";
|
|
3
|
+
export function registerReferenceTools(server, client) {
|
|
4
|
+
server.registerTool("cplace_get_type_incoming_references", {
|
|
5
|
+
description: "Get comprehensive information about all incoming references to a specific type definition. Identifies all attributes from other types that can reference pages of the target type, including custom attributes and built-in attributes.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
workspaceId: z.string().describe("The ID of the workspace containing the target type definition"),
|
|
8
|
+
internalName: z.string().describe("The internal name of the target type definition")
|
|
9
|
+
},
|
|
10
|
+
annotations: { title: "Get Type Incoming References" }
|
|
11
|
+
}, async ({ workspaceId, internalName }) => {
|
|
12
|
+
debugLogWithTag('TYPE_REFS', `Starting incoming references request for type: ${internalName} in workspace: ${workspaceId}`);
|
|
13
|
+
try {
|
|
14
|
+
const result = await client.makeApiRequest('json/type/incoming-references', 'GET', {
|
|
15
|
+
workspaceId,
|
|
16
|
+
internalName
|
|
17
|
+
});
|
|
18
|
+
debugLogWithTag('TYPE_REFS', `Retrieved ${result.count || 0} incoming references for type: ${internalName}`);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
debugLogWithTag('TYPE_REFS', `Error retrieving incoming references: ${error instanceof Error ? error.message : String(error)}`);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: `Error retrieving type incoming references: ${error instanceof Error ? error.message : String(error)}` }]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
server.registerTool("cplace_get_page_incoming_references", {
|
|
31
|
+
description: "Get comprehensive information about all incoming references to a specific page. Identifies all pages that reference the target page through specific attributes, providing detailed information about the referencing pages and the attributes used for the references.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
pageUID: z.string().describe("The unique identifier (UID) of the target page"),
|
|
34
|
+
includeReferences: z.string().describe("JSON string specifying which references to include. Must be a JSON array containing objects with 'sourceType' and 'attributeName' properties, e.g. '[{\"sourceType\":\"cf.example.Project\",\"attributeName\":\"relatedTask\"}]'")
|
|
35
|
+
},
|
|
36
|
+
annotations: { title: "Get Page Incoming References" }
|
|
37
|
+
}, async ({ pageUID, includeReferences }) => {
|
|
38
|
+
debugLogWithTag('PAGE_REFS', `Starting incoming references request for page: ${pageUID}`);
|
|
39
|
+
try {
|
|
40
|
+
const result = await client.makeApiRequest('json/page/incoming-references', 'GET', {
|
|
41
|
+
pageUID,
|
|
42
|
+
includeReferences
|
|
43
|
+
});
|
|
44
|
+
debugLogWithTag('PAGE_REFS', `Retrieved ${result.totalCount || 0} incoming references for page: ${pageUID}`);
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
debugLogWithTag('PAGE_REFS', `Error retrieving incoming references: ${error instanceof Error ? error.message : String(error)}`);
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "text", text: `Error retrieving page incoming references: ${error instanceof Error ? error.message : String(error)}` }]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,8CAA8C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;aAC1I,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAO1D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QAkY7E"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import SearchFilterSchema from "../searchSchema.js";
|
|
3
|
+
import { convertSearchFilterToCplaceFormat } from "../searchConversion.js";
|
|
4
|
+
import { filterSearchResult, checkResponseSize } from "../utils.js";
|
|
5
|
+
import { debugLogWithTag } from "../logger.js";
|
|
6
|
+
import { convertPagesToCsv } from "../csvUtils.js";
|
|
7
|
+
export function registerSearchTools(server, client) {
|
|
8
|
+
server.registerTool("cplace_search_pages", {
|
|
9
|
+
description: "Search pages of a type in cplace.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
workspaceId: z.string().optional().describe("The ID of the workspace to search in. If not provided, searches across all accessible workspaces."),
|
|
12
|
+
internalTypeName: z.string().describe(`The internal name of the type to filter by. Examples:
|
|
13
|
+
- "cf.cplace.solution.safe.feature" for Feature pages
|
|
14
|
+
- "cf.cplace.solution.safe.epic" for Epic pages
|
|
15
|
+
- "cf.cplace.solution.safe.story" for Story pages
|
|
16
|
+
- "cf.projectNavigator.project" for Project pages
|
|
17
|
+
- "cf.cplace.solution.safe.portfolio" for Portfolio pages
|
|
18
|
+
Use cplace_get_types_in_workspace to discover available types in a workspace.`),
|
|
19
|
+
search_filter: SearchFilterSchema.describe(`Search Filters using cplace filter format. Examples:
|
|
20
|
+
|
|
21
|
+
Basic string filter:
|
|
22
|
+
[{"attribute": "cf.cplace.workflow", "string": {"equals": "approved"}}]
|
|
23
|
+
|
|
24
|
+
Multiple conditions:
|
|
25
|
+
[
|
|
26
|
+
{"name": {"equals": "Project Alpha"}},
|
|
27
|
+
{"attribute": "cf.cplace.location", "reference": {"equals": "page/abc123"}}
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
Date range filter:
|
|
31
|
+
[
|
|
32
|
+
{"attribute": "cf.cplace.projectStart", "date": {"on_or_after": "2023-01-01"}},
|
|
33
|
+
{"attribute": "cf.cplace.projectFinish", "date": {"on_or_before": "2024-12-31"}}
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
Number comparison:
|
|
37
|
+
[{"attribute": "cf.cplace.estimatedCost", "number": {"greater_than": 1000}}]
|
|
38
|
+
|
|
39
|
+
Logical OR operator:
|
|
40
|
+
[{
|
|
41
|
+
"or": [
|
|
42
|
+
{"attribute": "cf.cplace.managementPriority", "string": {"equals": "Focus"}},
|
|
43
|
+
{"attribute": "cf.cplace.managementPriority", "string": {"equals": "Accelerate"}}
|
|
44
|
+
]
|
|
45
|
+
}]
|
|
46
|
+
|
|
47
|
+
Complex AND/OR combination:
|
|
48
|
+
[{
|
|
49
|
+
"and": [
|
|
50
|
+
{"attribute": "cf.cplace.workflow", "string": {"equals": "inProgress"}},
|
|
51
|
+
{
|
|
52
|
+
"or": [
|
|
53
|
+
{"attribute": "cf.cplace.priority", "string": {"equals": "High"}},
|
|
54
|
+
{"attribute": "cf.cplace.priority", "string": {"equals": "Critical"}}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}]
|
|
59
|
+
|
|
60
|
+
Boolean filter:
|
|
61
|
+
[{"attribute": "cf.cplace.isActive", "boolean": {"equals": true}}]
|
|
62
|
+
|
|
63
|
+
Empty/not empty checks:
|
|
64
|
+
[{"attribute": "cf.cplace.description", "string": {"is_not_empty": true}}]`),
|
|
65
|
+
limit: z.number().min(1).max(1000).default(50).describe("Maximum number of results to return (1-1000)"),
|
|
66
|
+
offset: z.number().min(0).max(10000).default(0).describe("Number of results to skip for pagination, cannot be larger than 10000"),
|
|
67
|
+
responseFormat: z.enum(["minimal", "count"]).optional().describe(`Response format options:
|
|
68
|
+
- Default (not specified): Complete page data, respects 'attributes' parameter
|
|
69
|
+
- "minimal": Only core fields (id, name, url, type, workspace)
|
|
70
|
+
- "count": Only return the total count of matching pages`),
|
|
71
|
+
attributes: z.array(z.string()).optional().describe("Specific attribute names to include in response. If not provided, all attributes are included. Examples: ['cf.cplace.workflow', 'cf.cplace.priority']"),
|
|
72
|
+
},
|
|
73
|
+
annotations: { title: "Search Pages" }
|
|
74
|
+
}, async ({ workspaceId, internalTypeName, search_filter, limit = 50, offset = 0, responseFormat, attributes, }) => {
|
|
75
|
+
debugLogWithTag('SEARCH', `Starting search with params: workspaceId=${workspaceId || 'none'}, type=${internalTypeName}, filter=${JSON.stringify(search_filter)}, limit=${limit}, offset=${offset}`);
|
|
76
|
+
try {
|
|
77
|
+
const cplaceFilter = convertSearchFilterToCplaceFormat(search_filter);
|
|
78
|
+
debugLogWithTag('SEARCH', `Converted filter: ${JSON.stringify(cplaceFilter)}`);
|
|
79
|
+
if (workspaceId) {
|
|
80
|
+
cplaceFilter.filters.unshift({
|
|
81
|
+
type: "Workspace",
|
|
82
|
+
workspaceIds: [workspaceId]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (internalTypeName) {
|
|
86
|
+
cplaceFilter.filters.unshift({
|
|
87
|
+
type: "Type",
|
|
88
|
+
types: [internalTypeName]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
debugLogWithTag('SEARCH', `Final cplace filter: ${JSON.stringify(cplaceFilter)}`);
|
|
92
|
+
const result = await client.makeApiRequest('json/search', 'GET', {
|
|
93
|
+
filter: JSON.stringify(cplaceFilter),
|
|
94
|
+
limit,
|
|
95
|
+
offset
|
|
96
|
+
});
|
|
97
|
+
if (responseFormat === "count") {
|
|
98
|
+
const countResult = {
|
|
99
|
+
count: result.pagination?.total || 0
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
content: [{ type: "text", text: JSON.stringify(countResult, null, 2) }]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const filteredResults = result.results ? result.results.map((item) => filterSearchResult(item, {
|
|
106
|
+
minimal: responseFormat === "minimal",
|
|
107
|
+
includeAttributes: responseFormat !== "minimal",
|
|
108
|
+
includeMetadata: false,
|
|
109
|
+
attributeFields: attributes,
|
|
110
|
+
truncateLargeValues: true
|
|
111
|
+
})) : [];
|
|
112
|
+
const filteredResult = {
|
|
113
|
+
results: filteredResults,
|
|
114
|
+
pagination: {
|
|
115
|
+
total: result.pagination?.total || 0,
|
|
116
|
+
limit: result.pagination?.limit || limit,
|
|
117
|
+
offset: result.pagination?.offset || offset,
|
|
118
|
+
hasMore: result.pagination?.hasMore || false
|
|
119
|
+
},
|
|
120
|
+
humanReadableRepresentation: result.summary,
|
|
121
|
+
cplaceJson: result.cplaceJson
|
|
122
|
+
};
|
|
123
|
+
const sizeCheck = checkResponseSize(filteredResult);
|
|
124
|
+
if (sizeCheck.tooLarge) {
|
|
125
|
+
return {
|
|
126
|
+
content: [{ type: "text", text: sizeCheck.suggestion }]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text: JSON.stringify(filteredResult, null, 2) }]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
debugLogWithTag('SEARCH', `Error during search: ${error instanceof Error ? error.message : String(error)}`);
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text: `Error converting or executing search: ${error instanceof Error ? error.message : String(error)}` }]
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
server.registerTool("cplace_search_pages_fulltext", {
|
|
141
|
+
description: "Make a fulltext search across all pages in cplace. Use this when searching for text content within pages.",
|
|
142
|
+
inputSchema: {
|
|
143
|
+
workspaceId: z.string().optional().describe("The ID of the workspace to search in. If not provided, searches across all accessible workspaces."),
|
|
144
|
+
fulltext: z.string().describe("The fulltext search query to filter pages by. The results will include pages that contain this string in their name, attributes, or content."),
|
|
145
|
+
limit: z.number().min(1).max(1000).default(50).describe("Maximum number of results to return (1-1000)"),
|
|
146
|
+
offset: z.number().min(0).max(10000).default(0).describe("Number of results to skip for pagination, cannot be larger than 10000"),
|
|
147
|
+
},
|
|
148
|
+
annotations: { title: "Search Pages by Fulltext" }
|
|
149
|
+
}, async ({ workspaceId, fulltext, limit = 50, offset = 0, }) => {
|
|
150
|
+
if (!fulltext) {
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: "text", text: "fulltext is required" }]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const result = await client.makeApiRequest('json/fulltext-search', 'GET', {
|
|
157
|
+
spaceId: workspaceId,
|
|
158
|
+
fulltext: `"${fulltext}"`,
|
|
159
|
+
limit,
|
|
160
|
+
offset
|
|
161
|
+
});
|
|
162
|
+
const filteredResults = result.results ? result.results.map((item) => filterSearchResult(item, {
|
|
163
|
+
minimal: false,
|
|
164
|
+
includeAttributes: true,
|
|
165
|
+
includeMetadata: false,
|
|
166
|
+
truncateLargeValues: true
|
|
167
|
+
})) : [];
|
|
168
|
+
const filteredResult = {
|
|
169
|
+
results: filteredResults,
|
|
170
|
+
pagination: {
|
|
171
|
+
total: result.pagination?.total || 0,
|
|
172
|
+
limit: result.pagination?.limit || limit,
|
|
173
|
+
offset: result.pagination?.offset || offset,
|
|
174
|
+
hasMore: result.pagination?.hasMore || false
|
|
175
|
+
},
|
|
176
|
+
summary: result.summary,
|
|
177
|
+
cplaceJson: result.cplaceJson
|
|
178
|
+
};
|
|
179
|
+
const sizeCheck = checkResponseSize(filteredResult);
|
|
180
|
+
if (sizeCheck.tooLarge) {
|
|
181
|
+
return {
|
|
182
|
+
content: [{ type: "text", text: sizeCheck.suggestion }]
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
content: [{ type: "text", text: JSON.stringify(filteredResult, null, 2) }]
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
return {
|
|
191
|
+
content: [{ type: "text", text: `Error converting or executing search: ${error instanceof Error ? error.message : String(error)}` }]
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
server.registerTool("cplace_list_pages_of_type", {
|
|
196
|
+
description: "List all pages of a specific type in a workspace in cplace. Use this to retrieve multiple pages of the same type.",
|
|
197
|
+
inputSchema: {
|
|
198
|
+
workspaceId: z.string().describe("The ID of the workspace to get pages from"),
|
|
199
|
+
typeName: z.string().describe("The internal name of the type to retrieve pages for"),
|
|
200
|
+
limit: z.number().min(1).max(1000).default(50).describe("Maximum number of results to return (1-1000)"),
|
|
201
|
+
offset: z.number().min(0).max(10000).default(0).describe("Number of results to skip for pagination, cannot be larger than 10000"),
|
|
202
|
+
},
|
|
203
|
+
annotations: { title: "List Pages of Type" }
|
|
204
|
+
}, async ({ workspaceId, typeName, limit = 50, offset = 0, }) => {
|
|
205
|
+
try {
|
|
206
|
+
const cplaceFilter = {
|
|
207
|
+
filters: [
|
|
208
|
+
{
|
|
209
|
+
type: "Workspace",
|
|
210
|
+
workspaceIds: [workspaceId]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "Type",
|
|
214
|
+
types: [typeName]
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
const result = await client.makeApiRequest('json/search', 'GET', {
|
|
219
|
+
filter: JSON.stringify(cplaceFilter),
|
|
220
|
+
limit,
|
|
221
|
+
offset
|
|
222
|
+
});
|
|
223
|
+
const filteredResults = result.results ? result.results.map((item) => filterSearchResult(item, {
|
|
224
|
+
minimal: false,
|
|
225
|
+
includeAttributes: true,
|
|
226
|
+
includeMetadata: false,
|
|
227
|
+
truncateLargeValues: true
|
|
228
|
+
})) : [];
|
|
229
|
+
const filteredResult = {
|
|
230
|
+
results: filteredResults,
|
|
231
|
+
pagination: {
|
|
232
|
+
total: result.pagination?.total || 0,
|
|
233
|
+
limit: result.pagination?.limit || limit,
|
|
234
|
+
offset: result.pagination?.offset || offset,
|
|
235
|
+
hasMore: result.pagination?.hasMore || false
|
|
236
|
+
},
|
|
237
|
+
summary: result.summary
|
|
238
|
+
};
|
|
239
|
+
const sizeCheck = checkResponseSize(filteredResult);
|
|
240
|
+
if (sizeCheck.tooLarge) {
|
|
241
|
+
return {
|
|
242
|
+
content: [{ type: "text", text: sizeCheck.suggestion }]
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
content: [{ type: "text", text: JSON.stringify(filteredResult, null, 2) }]
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
return {
|
|
251
|
+
content: [{ type: "text", text: `Error retrieving pages: ${error instanceof Error ? error.message : String(error)}` }]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
server.registerTool("cplace_search_pages_csv", {
|
|
256
|
+
description: "Same as cplace_search_pages but returns results in CSV format instead of JSON. Only use this tool after first calling cplace_search_pages to establish and validate the search parameters. The CSV result should always be stored as an artifact.",
|
|
257
|
+
inputSchema: {
|
|
258
|
+
workspaceId: z.string().optional().describe("Same as cplace_search_pages"),
|
|
259
|
+
internalTypeName: z.string().describe("Same as cplace_search_pages"),
|
|
260
|
+
search_filter: SearchFilterSchema.describe("Same as cplace_search_pages"),
|
|
261
|
+
limit: z.number().min(1).max(1000).default(50).describe("Same as cplace_search_pages"),
|
|
262
|
+
offset: z.number().min(0).max(10000).default(0).describe("Same as cplace_search_pages"),
|
|
263
|
+
attributes: z.array(z.string()).optional().describe("Same as cplace_search_pages"),
|
|
264
|
+
},
|
|
265
|
+
annotations: { title: "Search Pages (CSV Export)" }
|
|
266
|
+
}, async ({ workspaceId, internalTypeName, search_filter, limit = 50, offset = 0, attributes, }) => {
|
|
267
|
+
debugLogWithTag('CSV_SEARCH', `Starting CSV search with params: workspaceId=${workspaceId || 'none'}, type=${internalTypeName}, filter=${JSON.stringify(search_filter)}, limit=${limit}, offset=${offset}`);
|
|
268
|
+
try {
|
|
269
|
+
const cplaceFilter = convertSearchFilterToCplaceFormat(search_filter);
|
|
270
|
+
debugLogWithTag('CSV_SEARCH', `Converted filter: ${JSON.stringify(cplaceFilter)}`);
|
|
271
|
+
if (workspaceId) {
|
|
272
|
+
cplaceFilter.filters.unshift({
|
|
273
|
+
type: "Workspace",
|
|
274
|
+
workspaceIds: [workspaceId]
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
if (internalTypeName) {
|
|
278
|
+
cplaceFilter.filters.unshift({
|
|
279
|
+
type: "Type",
|
|
280
|
+
types: [internalTypeName]
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
debugLogWithTag('CSV_SEARCH', `Final cplace filter: ${JSON.stringify(cplaceFilter)}`);
|
|
284
|
+
const result = await client.makeApiRequest('json/search', 'GET', {
|
|
285
|
+
filter: JSON.stringify(cplaceFilter),
|
|
286
|
+
limit,
|
|
287
|
+
offset
|
|
288
|
+
});
|
|
289
|
+
const searchResults = result.results || [];
|
|
290
|
+
debugLogWithTag('CSV_SEARCH', `Retrieved ${searchResults.length} results for CSV conversion`);
|
|
291
|
+
const csvContent = await convertPagesToCsv(searchResults, client, attributes);
|
|
292
|
+
return {
|
|
293
|
+
content: [{ type: "text", text: csvContent }]
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
debugLogWithTag('CSV_SEARCH', `Error during CSV search: ${error instanceof Error ? error.message : String(error)}`);
|
|
298
|
+
return {
|
|
299
|
+
content: [{ type: "text", text: `Error converting or executing CSV search: ${error instanceof Error ? error.message : String(error)}` }]
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,kBAAkB,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAuB;IAC5E,MAAM,CAAC,YAAY,CAAC,qBAAqB,EACvC;QACE,WAAW,EAAE,mCAAmC;QAChD,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mGAAmG,CAAC;YAChJ,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;;;;;8EAMgC,CAAC;YACvE,aAAa,EAAE,kBAAkB,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EA6CwB,CAAC;YACpE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;YACvG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC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AC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,QAwBjE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DEBUG_LOGGING } from "../logger.js";
|
|
2
|
+
export function registerSystemTools(server, config) {
|
|
3
|
+
if (config.registerSystemInfoTool) {
|
|
4
|
+
server.registerTool("cplace_get_system_info", {
|
|
5
|
+
description: "Get system information about the MCP server - including current working directory, CPLACE_URL setting, and debug state",
|
|
6
|
+
inputSchema: {},
|
|
7
|
+
annotations: { title: "Get System Information" }
|
|
8
|
+
}, async () => {
|
|
9
|
+
const systemInfo = {
|
|
10
|
+
currentWorkingDirectory: process.cwd(),
|
|
11
|
+
cplaceUrl: config.url || 'Not set',
|
|
12
|
+
debugLogging: DEBUG_LOGGING,
|
|
13
|
+
nodeVersion: process.version,
|
|
14
|
+
platform: process.platform
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: JSON.stringify(systemInfo, null, 2) }]
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAW;IAEhE,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,wBAAwB,EAC5C;YACE,WAAW,EAAE,wHAAwH;YACrI,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE;SACjD,EACD,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG;gBACjB,uBAAuB,EAAE,OAAO,CAAC,GAAG,EAAE;gBACtC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAI,SAAS;gBAClC,YAAY,EAAE,aAAa;gBAC3B,WAAW,EAAE,OAAO,CAAC,OAAO;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACvE,CAAC;QACJ,CAAC,CACF,CAAC;IACF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-layouts.d.ts","sourceRoot":"","sources":["../../src/tools/type-layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAU5C,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QAqEjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { debugLogWithTag } from "../logger.js";
|
|
3
|
+
export function registerTypeLayoutTools(server, client) {
|
|
4
|
+
server.registerTool("cplace_get_type_layout", {
|
|
5
|
+
description: "Retrieves the widget layout structure of a specific type definition, including all widget configurations and layout definitions. This endpoint returns the effective layout used by the type, which can be either the default layout or an alternative layout.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
workspaceId: z.string().describe("The ID of the workspace containing the type definition"),
|
|
8
|
+
typeInternalName: z.string().describe("The internal name of the type definition"),
|
|
9
|
+
alternativeLayoutName: z.string().optional().describe("The name of the alternative layout to retrieve. If not provided, returns the default layout")
|
|
10
|
+
},
|
|
11
|
+
annotations: { title: "Get Type Layout" }
|
|
12
|
+
}, async ({ workspaceId, typeInternalName, alternativeLayoutName }) => {
|
|
13
|
+
debugLogWithTag('TYPE_LAYOUT', `Getting type layout for ${typeInternalName} in workspace ${workspaceId}${alternativeLayoutName ? ` (layout: ${alternativeLayoutName})` : ' (default)'}`);
|
|
14
|
+
try {
|
|
15
|
+
const params = { workspaceId, typeInternalName };
|
|
16
|
+
if (alternativeLayoutName) {
|
|
17
|
+
params.alternativeLayoutName = alternativeLayoutName;
|
|
18
|
+
}
|
|
19
|
+
const result = await client.makeApiRequest('json/typeLayout', 'GET', params);
|
|
20
|
+
debugLogWithTag('TYPE_LAYOUT', `Successfully retrieved type layout for ${typeInternalName}`);
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
debugLogWithTag('TYPE_LAYOUT', `Error retrieving type layout: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: `Error retrieving type layout: ${error instanceof Error ? error.message : String(error)}` }]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
server.registerTool("cplace_list_type_alternative_layouts", {
|
|
33
|
+
description: "Retrieves a comprehensive list of all available layouts for a specific type definition, including the default layout and all alternative layouts, along with usage statistics.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
workspaceId: z.string().describe("The ID of the workspace containing the type definition"),
|
|
36
|
+
typeInternalName: z.string().describe("The internal name of the type definition")
|
|
37
|
+
},
|
|
38
|
+
annotations: { title: "List Type Alternative Layouts" }
|
|
39
|
+
}, async ({ workspaceId, typeInternalName }) => {
|
|
40
|
+
debugLogWithTag('TYPE_LAYOUT', `Listing alternative layouts for type ${typeInternalName} in workspace ${workspaceId}`);
|
|
41
|
+
try {
|
|
42
|
+
const result = await client.makeApiRequest('json/typeLayout/list', 'GET', { workspaceId, typeInternalName });
|
|
43
|
+
debugLogWithTag('TYPE_LAYOUT', `Successfully listed layouts for type ${typeInternalName}`);
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
debugLogWithTag('TYPE_LAYOUT', `Error listing type layouts: ${error instanceof Error ? error.message : String(error)}`);
|
|
50
|
+
return {
|
|
51
|
+
content: [{ type: "text", text: `Error listing type layouts: ${error instanceof Error ? error.message : String(error)}` }]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=type-layouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-layouts.js","sourceRoot":"","sources":["../../src/tools/type-layouts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAS/C,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,MAAuB;IAEhF,MAAM,CAAC,YAAY,CAAC,wBAAwB,EAC1C;QACE,WAAW,EAAE,gQAAgQ;QAC7Q,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;YAC1F,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;YACjF,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6FAA6F,CAAC;SACrJ;QACD,WAAW,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE;KAC1C,EACD,KAAK,EAAE,EAAE,WAAW,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version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QA0E3E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { debugLogWithTag } from "../logger.js";
|
|
3
|
+
export function registerUserTools(server, client) {
|
|
4
|
+
server.registerTool("cplace_get_person_by_id", {
|
|
5
|
+
description: "Get details about a person including their name and email.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
id: z.string().describe("The ID of the person to get, e.g. 'person/kkt8ol745jqur4581kelm5ply'")
|
|
8
|
+
},
|
|
9
|
+
annotations: { title: "Get Person by ID" }
|
|
10
|
+
}, async ({ id }) => {
|
|
11
|
+
try {
|
|
12
|
+
const result = await client.makeApiRequest('json/person', 'GET', { id });
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return {
|
|
19
|
+
content: [{ type: "text", text: `Error retrieving person: ${error instanceof Error ? error.message : String(error)}` }]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
server.registerTool("cplace_get_person_by_name", {
|
|
24
|
+
description: "Get details about a person by searching for their name.",
|
|
25
|
+
inputSchema: {
|
|
26
|
+
name: z.string().describe("The name of the person or part of the name to search for"),
|
|
27
|
+
},
|
|
28
|
+
annotations: { title: "Get Person by Name" }
|
|
29
|
+
}, async ({ name }) => {
|
|
30
|
+
try {
|
|
31
|
+
const result = await client.makeApiRequest('json/person', 'GET', { name });
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: `Error searching for person: ${error instanceof Error ? error.message : String(error)}` }]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
server.registerTool("cplace_get_current_user", {
|
|
43
|
+
description: "Get information about the currently logged-in user, including their attributes and metadata",
|
|
44
|
+
inputSchema: {},
|
|
45
|
+
annotations: { title: "Get Current User" }
|
|
46
|
+
}, async () => {
|
|
47
|
+
debugLogWithTag('CURRENT_USER', 'Starting current user request');
|
|
48
|
+
try {
|
|
49
|
+
const result = await client.makeApiRequest('json/current-user');
|
|
50
|
+
debugLogWithTag('CURRENT_USER', `Retrieved current user information`);
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: "text", text: `Error retrieving current user information: ${error instanceof Error ? error.message : String(error)}` }]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAuB;IAE1E,MAAM,CAAC,YAAY,CAAC,yBAAyB,EAC3C;QACE,WAAW,EAAE,4DAA4D;QACzE,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;SAChG;QACD,WAAW,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE;KAC3C,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