@edicarlos.lds/businessmap-mcp 2.3.0 → 3.1.0
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/CONTRIBUTING.md +73 -0
- package/README.md +24 -4
- package/SECURITY.md +36 -0
- package/dist/client/businessmap-client.d.ts +17 -100
- package/dist/client/businessmap-client.d.ts.map +1 -1
- package/dist/client/businessmap-client.js +63 -283
- package/dist/client/businessmap-client.js.map +1 -1
- package/dist/client/businessmap-error.d.ts +16 -0
- package/dist/client/businessmap-error.d.ts.map +1 -0
- package/dist/client/businessmap-error.js +43 -0
- package/dist/client/businessmap-error.js.map +1 -0
- package/dist/client/modules/board-client.d.ts.map +1 -1
- package/dist/client/modules/board-client.js +16 -2
- package/dist/client/modules/board-client.js.map +1 -1
- package/dist/client/modules/card-client.d.ts +19 -5
- package/dist/client/modules/card-client.d.ts.map +1 -1
- package/dist/client/modules/card-client.js +61 -13
- package/dist/client/modules/card-client.js.map +1 -1
- package/dist/client/modules/custom-field-client.js +1 -1
- package/dist/client/modules/custom-field-client.js.map +1 -1
- package/dist/client/modules/doc-client.d.ts +44 -0
- package/dist/client/modules/doc-client.d.ts.map +1 -0
- package/dist/client/modules/doc-client.js +73 -0
- package/dist/client/modules/doc-client.js.map +1 -0
- package/dist/client/modules/index.d.ts +1 -0
- package/dist/client/modules/index.d.ts.map +1 -1
- package/dist/client/modules/index.js +1 -0
- package/dist/client/modules/index.js.map +1 -1
- package/dist/config/environment.d.ts +3 -0
- package/dist/config/environment.d.ts.map +1 -1
- package/dist/config/environment.js +60 -1
- package/dist/config/environment.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/schemas/card-schemas.d.ts +111 -85
- package/dist/schemas/card-schemas.d.ts.map +1 -1
- package/dist/schemas/card-schemas.js +39 -162
- package/dist/schemas/card-schemas.js.map +1 -1
- package/dist/schemas/common-schemas.d.ts +10 -4
- package/dist/schemas/common-schemas.d.ts.map +1 -1
- package/dist/schemas/common-schemas.js +25 -0
- package/dist/schemas/common-schemas.js.map +1 -1
- package/dist/schemas/doc-schemas.d.ts +176 -0
- package/dist/schemas/doc-schemas.d.ts.map +1 -0
- package/dist/schemas/doc-schemas.js +141 -0
- package/dist/schemas/doc-schemas.js.map +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/setup-schemas.d.ts +418 -0
- package/dist/schemas/setup-schemas.d.ts.map +1 -1
- package/dist/schemas/setup-schemas.js +30 -7
- package/dist/schemas/setup-schemas.js.map +1 -1
- package/dist/schemas/workspace-schemas.d.ts +3 -0
- package/dist/schemas/workspace-schemas.d.ts.map +1 -1
- package/dist/schemas/workspace-schemas.js +6 -0
- package/dist/schemas/workspace-schemas.js.map +1 -1
- package/dist/server/http.d.ts +7 -1
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/http.js +140 -31
- package/dist/server/http.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +2 -1
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/resources/board-resources.js +2 -2
- package/dist/server/resources/board-resources.js.map +1 -1
- package/dist/server/resources/card-resources.d.ts.map +1 -1
- package/dist/server/resources/card-resources.js +26 -2
- package/dist/server/resources/card-resources.js.map +1 -1
- package/dist/server/resources/workspace-resources.js +1 -1
- package/dist/server/resources/workspace-resources.js.map +1 -1
- package/dist/server/tools/base-tool.d.ts +39 -0
- package/dist/server/tools/base-tool.d.ts.map +1 -1
- package/dist/server/tools/base-tool.js +130 -0
- package/dist/server/tools/base-tool.js.map +1 -1
- package/dist/server/tools/board-tools.d.ts +0 -13
- package/dist/server/tools/board-tools.d.ts.map +1 -1
- package/dist/server/tools/board-tools.js +168 -257
- package/dist/server/tools/board-tools.js.map +1 -1
- package/dist/server/tools/card-tools.d.ts +6 -42
- package/dist/server/tools/card-tools.d.ts.map +1 -1
- package/dist/server/tools/card-tools.js +506 -702
- package/dist/server/tools/card-tools.js.map +1 -1
- package/dist/server/tools/custom-field-tools.d.ts +1 -2
- package/dist/server/tools/custom-field-tools.d.ts.map +1 -1
- package/dist/server/tools/custom-field-tools.js +8 -16
- package/dist/server/tools/custom-field-tools.js.map +1 -1
- package/dist/server/tools/doc-tools.d.ts +15 -0
- package/dist/server/tools/doc-tools.d.ts.map +1 -0
- package/dist/server/tools/doc-tools.js +307 -0
- package/dist/server/tools/doc-tools.js.map +1 -0
- package/dist/server/tools/index.d.ts +1 -0
- package/dist/server/tools/index.d.ts.map +1 -1
- package/dist/server/tools/index.js +1 -0
- package/dist/server/tools/index.js.map +1 -1
- package/dist/server/tools/setup-tools.d.ts +13 -2
- package/dist/server/tools/setup-tools.d.ts.map +1 -1
- package/dist/server/tools/setup-tools.js +145 -96
- package/dist/server/tools/setup-tools.js.map +1 -1
- package/dist/server/tools/user-tools.d.ts +0 -4
- package/dist/server/tools/user-tools.d.ts.map +1 -1
- package/dist/server/tools/user-tools.js +36 -65
- package/dist/server/tools/user-tools.js.map +1 -1
- package/dist/server/tools/utility-tools.d.ts +0 -2
- package/dist/server/tools/utility-tools.d.ts.map +1 -1
- package/dist/server/tools/utility-tools.js +15 -28
- package/dist/server/tools/utility-tools.js.map +1 -1
- package/dist/server/tools/workflow-tools.d.ts +0 -8
- package/dist/server/tools/workflow-tools.d.ts.map +1 -1
- package/dist/server/tools/workflow-tools.js +84 -139
- package/dist/server/tools/workflow-tools.js.map +1 -1
- package/dist/server/tools/workspace-tools.d.ts +0 -4
- package/dist/server/tools/workspace-tools.d.ts.map +1 -1
- package/dist/server/tools/workspace-tools.js +35 -65
- package/dist/server/tools/workspace-tools.js.map +1 -1
- package/dist/types/base.d.ts +1 -0
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/card.d.ts +21 -5
- package/dist/types/card.d.ts.map +1 -1
- package/dist/types/doc.d.ts +96 -0
- package/dist/types/doc.d.ts.map +1 -0
- package/dist/types/doc.js +3 -0
- package/dist/types/doc.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/workspace.d.ts +1 -0
- package/dist/types/workspace.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +7 -12
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +73 -10
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/request-context.d.ts +7 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +9 -0
- package/dist/utils/request-context.js.map +1 -0
- package/docs/LOGGING.md +15 -0
- package/docs/MIDDLEWARE.md +26 -4
- package/docs/TOOLS.md +43 -8
- package/package.json +4 -1
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { config } from '../../config/environment.js';
|
|
3
|
+
import { logger } from '../../utils/logger.js';
|
|
4
|
+
import { getRequestContext, runWithRequestContext } from '../../utils/request-context.js';
|
|
5
|
+
export const ESSENTIAL_TOOLS = new Set([
|
|
6
|
+
'list_workspaces',
|
|
7
|
+
'get_workspace',
|
|
8
|
+
'list_boards',
|
|
9
|
+
'search_board',
|
|
10
|
+
'get_columns',
|
|
11
|
+
'get_lanes',
|
|
12
|
+
'get_current_board_structure',
|
|
13
|
+
'list_cards',
|
|
14
|
+
'search_cards',
|
|
15
|
+
'get_card',
|
|
16
|
+
'get_card_comments',
|
|
17
|
+
'get_card_subtasks',
|
|
18
|
+
'get_card_parents',
|
|
19
|
+
'get_card_children',
|
|
20
|
+
'create_card',
|
|
21
|
+
'move_card',
|
|
22
|
+
'update_card',
|
|
23
|
+
'create_comment',
|
|
24
|
+
'search_docs',
|
|
25
|
+
'list_docs',
|
|
26
|
+
'get_doc_content_batch',
|
|
27
|
+
'list_users',
|
|
28
|
+
'get_current_user',
|
|
29
|
+
'health_check',
|
|
30
|
+
'get_api_info',
|
|
31
|
+
]);
|
|
1
32
|
/**
|
|
2
33
|
* Standard error handler for tool responses
|
|
3
34
|
*/
|
|
@@ -27,4 +58,103 @@ export function createSuccessResponse(data, message) {
|
|
|
27
58
|
],
|
|
28
59
|
};
|
|
29
60
|
}
|
|
61
|
+
/** Annotations for read-only tools */
|
|
62
|
+
export const READ_ONLY = { readOnlyHint: true, idempotentHint: true };
|
|
63
|
+
/** Annotations for non-destructive write tools (create) */
|
|
64
|
+
export const WRITE = {
|
|
65
|
+
readOnlyHint: false,
|
|
66
|
+
destructiveHint: false,
|
|
67
|
+
idempotentHint: false,
|
|
68
|
+
};
|
|
69
|
+
/** Annotations for idempotent write tools (update/toggle) */
|
|
70
|
+
export const WRITE_IDEMPOTENT = {
|
|
71
|
+
readOnlyHint: false,
|
|
72
|
+
destructiveHint: false,
|
|
73
|
+
idempotentHint: true,
|
|
74
|
+
};
|
|
75
|
+
/** Annotations for destructive operations that are safe to repeat */
|
|
76
|
+
export const DESTRUCTIVE_IDEMPOTENT = {
|
|
77
|
+
readOnlyHint: false,
|
|
78
|
+
destructiveHint: true,
|
|
79
|
+
idempotentHint: true,
|
|
80
|
+
};
|
|
81
|
+
/** Annotations for destructive operations that may not be safe to repeat */
|
|
82
|
+
export const DESTRUCTIVE = {
|
|
83
|
+
readOnlyHint: false,
|
|
84
|
+
destructiveHint: true,
|
|
85
|
+
idempotentHint: false,
|
|
86
|
+
};
|
|
87
|
+
function isToolResponse(value) {
|
|
88
|
+
return (value !== null &&
|
|
89
|
+
typeof value === 'object' &&
|
|
90
|
+
'content' in value &&
|
|
91
|
+
Array.isArray(value.content));
|
|
92
|
+
}
|
|
93
|
+
function getAuditIdentifiers(args) {
|
|
94
|
+
return Object.fromEntries(Object.entries(args).filter(([key, value]) => {
|
|
95
|
+
if (!/(?:^|_)ids?$/.test(key)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return (typeof value === 'number' ||
|
|
99
|
+
(Array.isArray(value) && value.every((item) => typeof item === 'number')));
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Register a tool with standard try/catch error handling and JSON success formatting.
|
|
104
|
+
* The handler either returns plain data (serialized via createSuccessResponse) or a
|
|
105
|
+
* complete ToolResponse for tools that need custom response shaping.
|
|
106
|
+
*/
|
|
107
|
+
export function registerTool(server, def) {
|
|
108
|
+
if (config.businessMap.toolProfile === 'essential' && !ESSENTIAL_TOOLS.has(def.name)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const execute = async (args) => {
|
|
112
|
+
const startedAt = Date.now();
|
|
113
|
+
const isMutation = def.annotations?.readOnlyHint === false;
|
|
114
|
+
try {
|
|
115
|
+
const result = await def.handler(args);
|
|
116
|
+
if (isMutation) {
|
|
117
|
+
logger.info('MCP mutation tool completed', {
|
|
118
|
+
event: 'mcp_tool_mutation',
|
|
119
|
+
tool: def.name,
|
|
120
|
+
outcome: 'success',
|
|
121
|
+
durationMs: Date.now() - startedAt,
|
|
122
|
+
identifiers: getAuditIdentifiers(args),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (isToolResponse(result)) {
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
const message = typeof def.successMessage === 'function' ? def.successMessage(result) : def.successMessage;
|
|
129
|
+
return createSuccessResponse(result, message);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (isMutation) {
|
|
133
|
+
logger.warn('MCP mutation tool failed', {
|
|
134
|
+
event: 'mcp_tool_mutation',
|
|
135
|
+
tool: def.name,
|
|
136
|
+
outcome: 'error',
|
|
137
|
+
durationMs: Date.now() - startedAt,
|
|
138
|
+
identifiers: getAuditIdentifiers(args),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return createErrorResponse(error, def.errorContext);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const callback = async (args) => {
|
|
145
|
+
if (getRequestContext()) {
|
|
146
|
+
return execute(args);
|
|
147
|
+
}
|
|
148
|
+
return runWithRequestContext({ correlationId: randomUUID() }, () => execute(args));
|
|
149
|
+
};
|
|
150
|
+
server.registerTool(def.name, {
|
|
151
|
+
title: def.title,
|
|
152
|
+
description: def.description,
|
|
153
|
+
inputSchema: def.schema.shape,
|
|
154
|
+
...(def.annotations && { annotations: def.annotations }),
|
|
155
|
+
},
|
|
156
|
+
// The SDK infers its own callback arg/return types from the raw shape; our callback is
|
|
157
|
+
// structurally compatible (validated args in, ToolResponse out), so bridge the generics here.
|
|
158
|
+
callback);
|
|
159
|
+
}
|
|
30
160
|
//# sourceMappingURL=base-tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-tool.js","sourceRoot":"","sources":["../../../src/server/tools/base-tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-tool.js","sourceRoot":"","sources":["../../../src/server/tools/base-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE1F,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACrC,iBAAiB;IACjB,eAAe;IACf,aAAa;IACb,cAAc;IACd,aAAa;IACb,WAAW;IACX,6BAA6B;IAC7B,YAAY;IACZ,cAAc;IACd,UAAU;IACV,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,aAAa;IACb,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,uBAAuB;IACvB,YAAY;IACZ,kBAAkB;IAClB,cAAc;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C,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,qBAAqB,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC;IACF,MAAM,CAAC,YAAY,CACjB,GAAG,CAAC,IAAI,EACR;QACE,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK;QAC7B,GAAG,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;KACzD;IACD,uFAAuF;IACvF,8FAA8F;IAC9F,QAA+D,CAChE,CAAC;AACJ,CAAC"}
|
|
@@ -3,24 +3,11 @@ import { BusinessMapClient } from '../../client/businessmap-client.js';
|
|
|
3
3
|
import { BaseToolHandler } from './base-tool.js';
|
|
4
4
|
export declare class BoardToolHandler implements BaseToolHandler {
|
|
5
5
|
registerTools(server: McpServer, client: BusinessMapClient, readOnlyMode: boolean): void;
|
|
6
|
-
private registerListBoards;
|
|
7
|
-
private registerSearchBoard;
|
|
8
6
|
private searchBoardById;
|
|
9
7
|
private searchBoardByIdFallback;
|
|
10
8
|
private searchBoardByName;
|
|
11
9
|
private getAllBoards;
|
|
12
10
|
private getBoardWithStructure;
|
|
13
11
|
private formatBoardsList;
|
|
14
|
-
private registerGetColumns;
|
|
15
|
-
private registerGetLanes;
|
|
16
|
-
private registerGetLane;
|
|
17
|
-
private registerCreateBoard;
|
|
18
|
-
private registerCreateLane;
|
|
19
|
-
private registerUpdateLane;
|
|
20
|
-
private registerUpdateBoard;
|
|
21
|
-
private registerGetCurrentBoardStructure;
|
|
22
|
-
private registerCreateColumn;
|
|
23
|
-
private registerUpdateColumn;
|
|
24
|
-
private registerDeleteColumn;
|
|
25
12
|
}
|
|
26
13
|
//# sourceMappingURL=board-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-tools.d.ts","sourceRoot":"","sources":["../../../src/server/tools/board-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAmBvE,OAAO,
|
|
1
|
+
{"version":3,"file":"board-tools.d.ts","sourceRoot":"","sources":["../../../src/server/tools/board-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAmBvE,OAAO,EACL,eAAe,EAQhB,MAAM,gBAAgB,CAAC;AAExB,qBAAa,gBAAiB,YAAW,eAAe;IACtD,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;YAwM1E,eAAe;YAef,uBAAuB;YAoBvB,iBAAiB;YAiCjB,YAAY;YAKZ,qBAAqB;IAmBnC,OAAO,CAAC,gBAAgB;CAOzB"}
|
|
@@ -1,67 +1,186 @@
|
|
|
1
1
|
import { createBoardSchema, createColumnSchema, createColumnInputSchema, createLaneSchema, deleteColumnSchema, getColumnsSchema, getCurrentBoardStructureSchema, getLanesSchema, getLaneSchema, listBoardsSchema, searchBoardSchema, updateBoardSchema, updateColumnSchema, updateLaneSchema, } from '../../schemas/index.js';
|
|
2
2
|
import { logger } from '../../utils/logger.js';
|
|
3
|
-
import { createErrorResponse, createSuccessResponse } from './base-tool.js';
|
|
3
|
+
import { DESTRUCTIVE_IDEMPOTENT, READ_ONLY, WRITE, WRITE_IDEMPOTENT, createErrorResponse, createSuccessResponse, registerTool, } from './base-tool.js';
|
|
4
4
|
export class BoardToolHandler {
|
|
5
5
|
registerTools(server, client, readOnlyMode) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.registerGetColumns(server, client);
|
|
9
|
-
this.registerGetLanes(server, client);
|
|
10
|
-
this.registerGetLane(server, client);
|
|
11
|
-
this.registerGetCurrentBoardStructure(server, client);
|
|
12
|
-
if (!readOnlyMode) {
|
|
13
|
-
this.registerCreateBoard(server, client);
|
|
14
|
-
this.registerUpdateBoard(server, client);
|
|
15
|
-
this.registerCreateLane(server, client);
|
|
16
|
-
this.registerUpdateLane(server, client);
|
|
17
|
-
this.registerCreateColumn(server, client);
|
|
18
|
-
this.registerUpdateColumn(server, client);
|
|
19
|
-
this.registerDeleteColumn(server, client);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
registerListBoards(server, client) {
|
|
23
|
-
server.registerTool('list_boards', {
|
|
6
|
+
registerTool(server, {
|
|
7
|
+
name: 'list_boards',
|
|
24
8
|
title: 'List Boards',
|
|
25
9
|
description: 'Get a list of boards with optional filters',
|
|
26
|
-
|
|
27
|
-
annotations:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const boards = await client.getBoards(params);
|
|
31
|
-
return createSuccessResponse(boards);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
return createErrorResponse(error, 'fetching boards');
|
|
35
|
-
}
|
|
10
|
+
schema: listBoardsSchema,
|
|
11
|
+
annotations: READ_ONLY,
|
|
12
|
+
errorContext: 'fetching boards',
|
|
13
|
+
handler: (params) => client.boards.getBoards(params),
|
|
36
14
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
server.registerTool('search_board', {
|
|
15
|
+
registerTool(server, {
|
|
16
|
+
name: 'search_board',
|
|
40
17
|
title: 'Search Board',
|
|
41
18
|
description: 'Search for a board by ID or name, with intelligent fallback to list all boards if direct search fails',
|
|
42
|
-
|
|
43
|
-
annotations:
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
schema: searchBoardSchema,
|
|
20
|
+
annotations: READ_ONLY,
|
|
21
|
+
errorContext: 'searching for board',
|
|
22
|
+
handler: async ({ board_id, board_name, workspace_id }) => {
|
|
46
23
|
if (board_id) {
|
|
47
|
-
return
|
|
24
|
+
return this.searchBoardById(client, board_id, workspace_id);
|
|
48
25
|
}
|
|
49
26
|
if (board_name) {
|
|
50
|
-
return
|
|
27
|
+
return this.searchBoardByName(client, board_name, workspace_id);
|
|
51
28
|
}
|
|
52
29
|
// If neither ID nor name provided, list all boards
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
30
|
+
return this.getAllBoards(client, workspace_id);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
registerTool(server, {
|
|
34
|
+
name: 'get_columns',
|
|
35
|
+
title: 'Get Board Columns',
|
|
36
|
+
description: 'Get all columns for a board',
|
|
37
|
+
schema: getColumnsSchema,
|
|
38
|
+
annotations: READ_ONLY,
|
|
39
|
+
errorContext: 'fetching board columns',
|
|
40
|
+
handler: ({ board_id }) => client.boards.getColumns(board_id),
|
|
41
|
+
});
|
|
42
|
+
registerTool(server, {
|
|
43
|
+
name: 'get_lanes',
|
|
44
|
+
title: 'Get Board Lanes',
|
|
45
|
+
description: 'Get all lanes/swimlanes for a board',
|
|
46
|
+
schema: getLanesSchema,
|
|
47
|
+
annotations: READ_ONLY,
|
|
48
|
+
errorContext: 'fetching board lanes',
|
|
49
|
+
handler: ({ board_id }) => client.boards.getLanes(board_id),
|
|
50
|
+
});
|
|
51
|
+
registerTool(server, {
|
|
52
|
+
name: 'get_lane',
|
|
53
|
+
title: 'Get Lane Details',
|
|
54
|
+
description: 'Get details of a specific lane/swimlane',
|
|
55
|
+
schema: getLaneSchema,
|
|
56
|
+
annotations: READ_ONLY,
|
|
57
|
+
errorContext: 'fetching lane details',
|
|
58
|
+
handler: ({ board_id, lane_id }) => client.boards.getLane(board_id, lane_id),
|
|
59
|
+
});
|
|
60
|
+
registerTool(server, {
|
|
61
|
+
name: 'get_current_board_structure',
|
|
62
|
+
title: 'Get Current Board Structure',
|
|
63
|
+
description: 'Get the complete current structure of a board including workflows, columns, lanes, and configurations',
|
|
64
|
+
schema: getCurrentBoardStructureSchema,
|
|
65
|
+
annotations: READ_ONLY,
|
|
66
|
+
errorContext: 'getting current board structure',
|
|
67
|
+
successMessage: 'Board structure retrieved successfully:',
|
|
68
|
+
handler: ({ board_id }) => client.boards.getCurrentBoardStructure(board_id),
|
|
58
69
|
});
|
|
70
|
+
if (!readOnlyMode) {
|
|
71
|
+
registerTool(server, {
|
|
72
|
+
name: 'create_board',
|
|
73
|
+
title: 'Create Board',
|
|
74
|
+
description: 'Create a new board in a workspace',
|
|
75
|
+
schema: createBoardSchema,
|
|
76
|
+
annotations: WRITE,
|
|
77
|
+
errorContext: 'creating board',
|
|
78
|
+
successMessage: 'Board created successfully:',
|
|
79
|
+
handler: ({ name, workspace_id, description }) => client.boards.createBoard({ name, workspace_id, description }),
|
|
80
|
+
});
|
|
81
|
+
registerTool(server, {
|
|
82
|
+
name: 'update_board',
|
|
83
|
+
title: 'Update Board',
|
|
84
|
+
description: 'Update the name and/or description of an existing board',
|
|
85
|
+
schema: updateBoardSchema,
|
|
86
|
+
annotations: WRITE_IDEMPOTENT,
|
|
87
|
+
errorContext: 'updating board',
|
|
88
|
+
successMessage: 'Board updated successfully:',
|
|
89
|
+
handler: ({ board_id, name, description }) => client.boards.updateBoard(board_id, {
|
|
90
|
+
...(name !== undefined && { name }),
|
|
91
|
+
...(description !== undefined && { description }),
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
registerTool(server, {
|
|
95
|
+
name: 'create_lane',
|
|
96
|
+
title: 'Create Lane',
|
|
97
|
+
description: 'Create a new lane/swimlane in a board',
|
|
98
|
+
schema: createLaneSchema,
|
|
99
|
+
annotations: WRITE,
|
|
100
|
+
errorContext: 'creating lane',
|
|
101
|
+
successMessage: 'Lane created successfully:',
|
|
102
|
+
handler: ({ board_id, workflow_id, name, description, color, position, parent_lane_id }) => client.boards.createLane(board_id, {
|
|
103
|
+
workflow_id,
|
|
104
|
+
name,
|
|
105
|
+
description: description || null,
|
|
106
|
+
...(color !== undefined && { color }),
|
|
107
|
+
position,
|
|
108
|
+
...(parent_lane_id !== undefined && { parent_lane_id }),
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
registerTool(server, {
|
|
112
|
+
name: 'update_lane',
|
|
113
|
+
title: 'Update Lane',
|
|
114
|
+
description: 'Update an existing lane/swimlane (name, description, color, position or parent lane)',
|
|
115
|
+
schema: updateLaneSchema,
|
|
116
|
+
annotations: WRITE_IDEMPOTENT,
|
|
117
|
+
errorContext: 'updating lane',
|
|
118
|
+
successMessage: 'Lane updated successfully:',
|
|
119
|
+
handler: ({ board_id, lane_id, name, description, color, position, parent_lane_id }) => client.boards.updateLane(board_id, lane_id, {
|
|
120
|
+
...(name !== undefined && { name }),
|
|
121
|
+
...(description !== undefined && { description }),
|
|
122
|
+
...(color !== undefined && { color }),
|
|
123
|
+
...(position !== undefined && { position }),
|
|
124
|
+
...(parent_lane_id !== undefined && { parent_lane_id }),
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
registerTool(server, {
|
|
128
|
+
name: 'create_column',
|
|
129
|
+
title: 'Create Column',
|
|
130
|
+
description: 'Create a new column on a board. Supports both main columns (requires workflow_id and section) and sub-columns (requires parent_column_id). Section values: 1=Backlog, 2=Requested, 3=Progress, 4=Done.',
|
|
131
|
+
schema: createColumnInputSchema,
|
|
132
|
+
annotations: WRITE,
|
|
133
|
+
errorContext: 'creating column',
|
|
134
|
+
successMessage: 'Column created successfully:',
|
|
135
|
+
handler: (params) => {
|
|
136
|
+
const { board_id, workflow_id, section, parent_column_id, position, name, limit, description } = createColumnSchema.parse(params);
|
|
137
|
+
const sharedFields = {
|
|
138
|
+
position,
|
|
139
|
+
name,
|
|
140
|
+
...(limit !== undefined && { limit }),
|
|
141
|
+
...(description && { description }),
|
|
142
|
+
};
|
|
143
|
+
return client.boards.createColumn(board_id, parent_column_id
|
|
144
|
+
? { parent_column_id, ...sharedFields }
|
|
145
|
+
: { workflow_id, section, ...sharedFields });
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
registerTool(server, {
|
|
149
|
+
name: 'update_column',
|
|
150
|
+
title: 'Update Column',
|
|
151
|
+
description: 'Update the details of a specific column on a board',
|
|
152
|
+
schema: updateColumnSchema,
|
|
153
|
+
annotations: WRITE_IDEMPOTENT,
|
|
154
|
+
errorContext: 'updating column',
|
|
155
|
+
successMessage: 'Column updated successfully:',
|
|
156
|
+
handler: ({ board_id, column_id, name, limit, section, position, description }) => client.boards.updateColumn(board_id, column_id, {
|
|
157
|
+
...(name !== undefined && { name }),
|
|
158
|
+
...(limit !== undefined && { limit }),
|
|
159
|
+
...(section !== undefined && { section }),
|
|
160
|
+
...(position !== undefined && { position }),
|
|
161
|
+
...(description !== undefined && { description }),
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
registerTool(server, {
|
|
165
|
+
name: 'delete_column',
|
|
166
|
+
title: 'Delete Column',
|
|
167
|
+
description: 'Delete a column from a board',
|
|
168
|
+
schema: deleteColumnSchema,
|
|
169
|
+
annotations: DESTRUCTIVE_IDEMPOTENT,
|
|
170
|
+
errorContext: 'deleting column',
|
|
171
|
+
successMessage: 'Column deleted successfully:',
|
|
172
|
+
handler: async ({ board_id, column_id }) => {
|
|
173
|
+
await client.boards.deleteColumn(board_id, column_id);
|
|
174
|
+
return { board_id, column_id };
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}
|
|
59
178
|
}
|
|
60
179
|
async searchBoardById(client, boardId, workspaceId) {
|
|
61
180
|
try {
|
|
62
181
|
const [board, structure] = await Promise.all([
|
|
63
|
-
client.getBoard(boardId),
|
|
64
|
-
client.getBoardStructure(boardId),
|
|
182
|
+
client.boards.getBoard(boardId),
|
|
183
|
+
client.boards.getBoardStructure(boardId),
|
|
65
184
|
]);
|
|
66
185
|
return createSuccessResponse({ ...board, structure }, 'Board found directly:');
|
|
67
186
|
}
|
|
@@ -71,7 +190,7 @@ export class BoardToolHandler {
|
|
|
71
190
|
}
|
|
72
191
|
}
|
|
73
192
|
async searchBoardByIdFallback(client, boardId, workspaceId) {
|
|
74
|
-
const boards = await client.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
193
|
+
const boards = await client.boards.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
75
194
|
const foundBoard = boards.find((b) => b.board_id === boardId);
|
|
76
195
|
if (!foundBoard) {
|
|
77
196
|
return createErrorResponse(new Error(`Board with ID ${boardId} not found. Available boards:\n${JSON.stringify(this.formatBoardsList(boards), null, 2)}`), 'searching for board');
|
|
@@ -79,7 +198,7 @@ export class BoardToolHandler {
|
|
|
79
198
|
return await this.getBoardWithStructure(client, foundBoard, 'Board found via list search:');
|
|
80
199
|
}
|
|
81
200
|
async searchBoardByName(client, boardName, workspaceId) {
|
|
82
|
-
const boards = await client.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
201
|
+
const boards = await client.boards.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
83
202
|
const foundBoards = boards.filter((b) => b.name.toLowerCase().includes(boardName.toLowerCase()));
|
|
84
203
|
if (foundBoards.length === 0) {
|
|
85
204
|
return createErrorResponse(new Error(`No boards found matching name "${boardName}". Available boards:\n${JSON.stringify(this.formatBoardsList(boards), null, 2)}`), 'searching for board by name');
|
|
@@ -94,12 +213,12 @@ export class BoardToolHandler {
|
|
|
94
213
|
return createSuccessResponse(this.formatBoardsList(foundBoards), `Multiple boards found matching "${boardName}":`);
|
|
95
214
|
}
|
|
96
215
|
async getAllBoards(client, workspaceId) {
|
|
97
|
-
const boards = await client.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
216
|
+
const boards = await client.boards.getBoards(workspaceId ? { workspace_id: workspaceId } : undefined);
|
|
98
217
|
return createSuccessResponse(this.formatBoardsList(boards), 'All available boards:');
|
|
99
218
|
}
|
|
100
219
|
async getBoardWithStructure(client, board, successMessage) {
|
|
101
220
|
try {
|
|
102
|
-
const structure = await client.getBoardStructure(board.board_id);
|
|
221
|
+
const structure = await client.boards.getBoardStructure(board.board_id);
|
|
103
222
|
return createSuccessResponse({ ...board, structure }, successMessage);
|
|
104
223
|
}
|
|
105
224
|
catch (structureError) {
|
|
@@ -114,213 +233,5 @@ export class BoardToolHandler {
|
|
|
114
233
|
workspace_id: b.workspace_id,
|
|
115
234
|
}));
|
|
116
235
|
}
|
|
117
|
-
registerGetColumns(server, client) {
|
|
118
|
-
server.registerTool('get_columns', {
|
|
119
|
-
title: 'Get Board Columns',
|
|
120
|
-
description: 'Get all columns for a board',
|
|
121
|
-
inputSchema: getColumnsSchema.shape,
|
|
122
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
123
|
-
}, async ({ board_id }) => {
|
|
124
|
-
try {
|
|
125
|
-
const columns = await client.getColumns(board_id);
|
|
126
|
-
return createSuccessResponse(columns);
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
return createErrorResponse(error, 'fetching board columns');
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
registerGetLanes(server, client) {
|
|
134
|
-
server.registerTool('get_lanes', {
|
|
135
|
-
title: 'Get Board Lanes',
|
|
136
|
-
description: 'Get all lanes/swimlanes for a board',
|
|
137
|
-
inputSchema: getLanesSchema.shape,
|
|
138
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
139
|
-
}, async ({ board_id }) => {
|
|
140
|
-
try {
|
|
141
|
-
const lanes = await client.getLanes(board_id);
|
|
142
|
-
return createSuccessResponse(lanes);
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
return createErrorResponse(error, 'fetching board lanes');
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
registerGetLane(server, client) {
|
|
150
|
-
server.registerTool('get_lane', {
|
|
151
|
-
title: 'Get Lane Details',
|
|
152
|
-
description: 'Get details of a specific lane/swimlane',
|
|
153
|
-
inputSchema: getLaneSchema.shape,
|
|
154
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
155
|
-
}, async ({ board_id, lane_id }) => {
|
|
156
|
-
try {
|
|
157
|
-
const lane = await client.getLane(board_id, lane_id);
|
|
158
|
-
return createSuccessResponse(lane);
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
return createErrorResponse(error, 'fetching lane details');
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
registerCreateBoard(server, client) {
|
|
166
|
-
server.registerTool('create_board', {
|
|
167
|
-
title: 'Create Board',
|
|
168
|
-
description: 'Create a new board in a workspace',
|
|
169
|
-
inputSchema: createBoardSchema.shape,
|
|
170
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
171
|
-
}, async ({ name, workspace_id, description }) => {
|
|
172
|
-
try {
|
|
173
|
-
const board = await client.createBoard({
|
|
174
|
-
name,
|
|
175
|
-
workspace_id,
|
|
176
|
-
description,
|
|
177
|
-
});
|
|
178
|
-
return createSuccessResponse(board, 'Board created successfully:');
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
return createErrorResponse(error, 'creating board');
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
registerCreateLane(server, client) {
|
|
186
|
-
server.registerTool('create_lane', {
|
|
187
|
-
title: 'Create Lane',
|
|
188
|
-
description: 'Create a new lane/swimlane in a board',
|
|
189
|
-
inputSchema: createLaneSchema.shape,
|
|
190
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
191
|
-
}, async ({ board_id, workflow_id, name, description, color, position, parent_lane_id }) => {
|
|
192
|
-
try {
|
|
193
|
-
const lane = await client.createLane(board_id, {
|
|
194
|
-
workflow_id,
|
|
195
|
-
name,
|
|
196
|
-
description: description || null,
|
|
197
|
-
...(color !== undefined && { color }),
|
|
198
|
-
position,
|
|
199
|
-
...(parent_lane_id !== undefined && { parent_lane_id }),
|
|
200
|
-
});
|
|
201
|
-
return createSuccessResponse(lane, 'Lane created successfully:');
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
return createErrorResponse(error, 'creating lane');
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
registerUpdateLane(server, client) {
|
|
209
|
-
server.registerTool('update_lane', {
|
|
210
|
-
title: 'Update Lane',
|
|
211
|
-
description: 'Update an existing lane/swimlane (name, description, color, position or parent lane)',
|
|
212
|
-
inputSchema: updateLaneSchema.shape,
|
|
213
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
|
|
214
|
-
}, async ({ board_id, lane_id, name, description, color, position, parent_lane_id }) => {
|
|
215
|
-
try {
|
|
216
|
-
const lane = await client.updateLane(board_id, lane_id, {
|
|
217
|
-
...(name !== undefined && { name }),
|
|
218
|
-
...(description !== undefined && { description }),
|
|
219
|
-
...(color !== undefined && { color }),
|
|
220
|
-
...(position !== undefined && { position }),
|
|
221
|
-
...(parent_lane_id !== undefined && { parent_lane_id }),
|
|
222
|
-
});
|
|
223
|
-
return createSuccessResponse(lane, 'Lane updated successfully:');
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
return createErrorResponse(error, 'updating lane');
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
registerUpdateBoard(server, client) {
|
|
231
|
-
server.registerTool('update_board', {
|
|
232
|
-
title: 'Update Board',
|
|
233
|
-
description: 'Update the name and/or description of an existing board',
|
|
234
|
-
inputSchema: updateBoardSchema.shape,
|
|
235
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
|
|
236
|
-
}, async ({ board_id, name, description }) => {
|
|
237
|
-
try {
|
|
238
|
-
const board = await client.updateBoard(board_id, {
|
|
239
|
-
...(name !== undefined && { name }),
|
|
240
|
-
...(description !== undefined && { description }),
|
|
241
|
-
});
|
|
242
|
-
return createSuccessResponse(board, 'Board updated successfully:');
|
|
243
|
-
}
|
|
244
|
-
catch (error) {
|
|
245
|
-
return createErrorResponse(error, 'updating board');
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
registerGetCurrentBoardStructure(server, client) {
|
|
250
|
-
server.registerTool('get_current_board_structure', {
|
|
251
|
-
title: 'Get Current Board Structure',
|
|
252
|
-
description: 'Get the complete current structure of a board including workflows, columns, lanes, and configurations',
|
|
253
|
-
inputSchema: getCurrentBoardStructureSchema.shape,
|
|
254
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
255
|
-
}, async ({ board_id }) => {
|
|
256
|
-
try {
|
|
257
|
-
const structure = await client.getCurrentBoardStructure(board_id);
|
|
258
|
-
return createSuccessResponse(structure, 'Board structure retrieved successfully:');
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
return createErrorResponse(error, 'getting current board structure');
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
registerCreateColumn(server, client) {
|
|
266
|
-
server.registerTool('create_column', {
|
|
267
|
-
title: 'Create Column',
|
|
268
|
-
description: 'Create a new column on a board. Supports both main columns (requires workflow_id and section) and sub-columns (requires parent_column_id). Section values: 1=Backlog, 2=Requested, 3=Progress, 4=Done.',
|
|
269
|
-
inputSchema: createColumnInputSchema.shape,
|
|
270
|
-
}, async (params) => {
|
|
271
|
-
try {
|
|
272
|
-
const { board_id, workflow_id, section, parent_column_id, position, name, limit, description, } = createColumnSchema.parse(params);
|
|
273
|
-
const columnParams = parent_column_id
|
|
274
|
-
? { parent_column_id, position, name, ...(limit !== undefined && { limit }), ...(description && { description }) }
|
|
275
|
-
: { workflow_id, section, position, name, ...(limit !== undefined && { limit }), ...(description && { description }) };
|
|
276
|
-
const column = await client.createColumn(board_id, columnParams);
|
|
277
|
-
return createSuccessResponse(column, 'Column created successfully:');
|
|
278
|
-
}
|
|
279
|
-
catch (error) {
|
|
280
|
-
return createErrorResponse(error, 'creating column');
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
registerUpdateColumn(server, client) {
|
|
285
|
-
server.registerTool('update_column', {
|
|
286
|
-
title: 'Update Column',
|
|
287
|
-
description: 'Update the details of a specific column on a board',
|
|
288
|
-
inputSchema: updateColumnSchema.shape,
|
|
289
|
-
}, async ({ board_id, column_id, name, limit, section, position, description }) => {
|
|
290
|
-
try {
|
|
291
|
-
const params = {};
|
|
292
|
-
if (name !== undefined)
|
|
293
|
-
params['name'] = name;
|
|
294
|
-
if (limit !== undefined)
|
|
295
|
-
params['limit'] = limit;
|
|
296
|
-
if (section !== undefined)
|
|
297
|
-
params['section'] = section;
|
|
298
|
-
if (position !== undefined)
|
|
299
|
-
params['position'] = position;
|
|
300
|
-
if (description !== undefined)
|
|
301
|
-
params['description'] = description;
|
|
302
|
-
const column = await client.updateColumn(board_id, column_id, params);
|
|
303
|
-
return createSuccessResponse(column, 'Column updated successfully:');
|
|
304
|
-
}
|
|
305
|
-
catch (error) {
|
|
306
|
-
return createErrorResponse(error, 'updating column');
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
registerDeleteColumn(server, client) {
|
|
311
|
-
server.registerTool('delete_column', {
|
|
312
|
-
title: 'Delete Column',
|
|
313
|
-
description: 'Delete a column from a board',
|
|
314
|
-
inputSchema: deleteColumnSchema.shape,
|
|
315
|
-
}, async ({ board_id, column_id }) => {
|
|
316
|
-
try {
|
|
317
|
-
await client.deleteColumn(board_id, column_id);
|
|
318
|
-
return createSuccessResponse({ board_id, column_id }, 'Column deleted successfully:');
|
|
319
|
-
}
|
|
320
|
-
catch (error) {
|
|
321
|
-
return createErrorResponse(error, 'deleting column');
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
236
|
}
|
|
326
237
|
//# sourceMappingURL=board-tools.js.map
|