@x0333/bitrix24-mcp-server 2.3.1 → 2.3.3
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/index.js +21 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -35,14 +35,20 @@ function bitrixPortalUrlFromBase(base) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const B24_PORTAL_URL = bitrixPortalUrlFromBase(B24_BASE);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (!B24_PORTAL_URL) {
|
|
39
|
+
console.error("Error: B24_BASE must be a valid absolute URL with a host (e.g., https://domain.bitrix24.ru/rest/1/abcde/).");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const taskViewUrlPrefix = `${B24_PORTAL_URL}/company/personal/user/0/tasks/task/view/`;
|
|
44
|
+
const taskPortalLinkHowto =
|
|
45
|
+
`When the user needs a link to a task (or to paste one), use ${taskViewUrlPrefix}<task-id>/ — substitute only <task-id> with the numeric task ID from the API. Example: ${taskViewUrlPrefix}9483/`;
|
|
46
|
+
const mcpInstructions = `Bitrix24 address: ${B24_PORTAL_URL}. ${taskPortalLinkHowto}`;
|
|
41
47
|
|
|
42
48
|
const server = new Server(
|
|
43
49
|
{
|
|
44
50
|
name: "bitrix24-mcp-server",
|
|
45
|
-
version: "2.3.
|
|
51
|
+
version: "2.3.3",
|
|
46
52
|
},
|
|
47
53
|
{
|
|
48
54
|
capabilities: {
|
|
@@ -140,7 +146,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
140
146
|
},
|
|
141
147
|
{
|
|
142
148
|
name: "get_task",
|
|
143
|
-
description:
|
|
149
|
+
description:
|
|
150
|
+
"Retrieve task details by ID from Bitrix24. " +
|
|
151
|
+
taskPortalLinkHowto +
|
|
152
|
+
" The tool response JSON includes agent_instructions with the same rule plus a direct link for the requested task id.",
|
|
144
153
|
inputSchema: {
|
|
145
154
|
type: "object",
|
|
146
155
|
properties: {
|
|
@@ -255,9 +264,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
255
264
|
}
|
|
256
265
|
|
|
257
266
|
case "get_task": {
|
|
267
|
+
const taskId = Number(args.id);
|
|
258
268
|
const body = { taskId: args.id, select: args.select || ["*"] };
|
|
259
269
|
const data = await callBitrix("tasks.task.get", body);
|
|
260
|
-
|
|
270
|
+
throwIfBitrixError(data, "tasks.task.get");
|
|
271
|
+
const payload = {
|
|
272
|
+
...data,
|
|
273
|
+
agent_instructions: `${taskPortalLinkHowto} For this task: ${taskViewUrlPrefix}${taskId}/`,
|
|
274
|
+
};
|
|
275
|
+
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
261
276
|
}
|
|
262
277
|
|
|
263
278
|
case "search_tasks": {
|