backlog-mcp-server 0.16.0 → 0.18.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/README.ja.md +15 -32
- package/README.md +20 -32
- package/build/auth/oauthRoutes.js +53 -1
- package/build/createBacklogMcpServer.d.ts +4 -6
- package/build/createBacklogMcpServer.js +4 -12
- package/build/handlers/builders/composeToolHandler.d.ts +1 -1
- package/build/handlers/builders/composeToolHandler.js +15 -9
- package/build/handlers/transformers/wrapWithFieldPicking.d.ts +14 -1
- package/build/handlers/transformers/wrapWithFieldPicking.js +30 -36
- package/build/index.js +30 -16
- package/build/lib.d.ts +1 -1
- package/build/loadDescriptionOverrides.d.ts +0 -13
- package/build/loadDescriptionOverrides.js +73 -11
- package/build/reportUnknownOverrideKeys.d.ts +22 -0
- package/build/reportUnknownOverrideKeys.js +42 -0
- package/build/tools/addDocument.d.ts +2 -2
- package/build/tools/addDocument.js +17 -2
- package/build/tools/addIssue.d.ts +2 -2
- package/build/tools/addIssue.js +32 -2
- package/build/tools/addIssueComment.d.ts +2 -2
- package/build/tools/addIssueComment.js +14 -2
- package/build/tools/addProject.d.ts +2 -2
- package/build/tools/addProject.js +22 -2
- package/build/tools/addPullRequest.d.ts +2 -2
- package/build/tools/addPullRequest.js +26 -2
- package/build/tools/addPullRequestComment.d.ts +2 -2
- package/build/tools/addPullRequestComment.js +12 -2
- package/build/tools/addRelatedIssue.d.ts +2 -2
- package/build/tools/addRelatedIssue.js +33 -2
- package/build/tools/addVersionMilestone.d.ts +2 -2
- package/build/tools/addVersionMilestone.js +12 -2
- package/build/tools/addWatching.d.ts +2 -2
- package/build/tools/addWatching.js +12 -2
- package/build/tools/addWiki.d.ts +2 -2
- package/build/tools/addWiki.js +16 -2
- package/build/tools/countIssues.d.ts +2 -2
- package/build/tools/countIssues.js +3 -2
- package/build/tools/deleteIssue.d.ts +2 -2
- package/build/tools/deleteIssue.js +32 -2
- package/build/tools/deleteProject.d.ts +2 -2
- package/build/tools/deleteProject.js +22 -2
- package/build/tools/deleteVersion.d.ts +2 -2
- package/build/tools/deleteVersion.js +12 -2
- package/build/tools/deleteWatching.d.ts +2 -2
- package/build/tools/deleteWatching.js +12 -2
- package/build/tools/getCategories.d.ts +2 -2
- package/build/tools/getCategories.js +8 -2
- package/build/tools/getCustomFields.d.ts +2 -2
- package/build/tools/getCustomFields.js +22 -2
- package/build/tools/getDocument.d.ts +2 -2
- package/build/tools/getDocument.js +17 -2
- package/build/tools/getDocumentTree.d.ts +2 -2
- package/build/tools/getDocumentTree.js +7 -2
- package/build/tools/getDocuments.d.ts +2 -2
- package/build/tools/getDocuments.js +17 -2
- package/build/tools/getGitRepositories.d.ts +2 -2
- package/build/tools/getGitRepositories.js +17 -2
- package/build/tools/getGitRepository.d.ts +2 -2
- package/build/tools/getGitRepository.js +17 -2
- package/build/tools/getIssue.d.ts +2 -2
- package/build/tools/getIssue.js +32 -2
- package/build/tools/getIssueComments.d.ts +2 -2
- package/build/tools/getIssueComments.js +14 -2
- package/build/tools/getIssueTypes.d.ts +2 -2
- package/build/tools/getIssueTypes.js +11 -2
- package/build/tools/getIssues.d.ts +10 -10
- package/build/tools/getIssues.js +32 -2
- package/build/tools/getMyself.d.ts +2 -2
- package/build/tools/getMyself.js +11 -2
- package/build/tools/getNotifications.d.ts +2 -2
- package/build/tools/getNotifications.js +15 -2
- package/build/tools/getNotificationsCount.d.ts +2 -2
- package/build/tools/getNotificationsCount.js +5 -2
- package/build/tools/getPriorities.d.ts +2 -2
- package/build/tools/getPriorities.js +3 -2
- package/build/tools/getProject.d.ts +2 -2
- package/build/tools/getProject.js +22 -2
- package/build/tools/getProjectList.d.ts +2 -2
- package/build/tools/getProjectList.js +22 -2
- package/build/tools/getProjectUsers.d.ts +2 -2
- package/build/tools/getProjectUsers.js +11 -2
- package/build/tools/getPullRequest.d.ts +2 -2
- package/build/tools/getPullRequest.js +26 -2
- package/build/tools/getPullRequestComments.d.ts +2 -2
- package/build/tools/getPullRequestComments.js +12 -2
- package/build/tools/getPullRequests.d.ts +2 -2
- package/build/tools/getPullRequests.js +26 -2
- package/build/tools/getPullRequestsCount.d.ts +2 -2
- package/build/tools/getPullRequestsCount.js +5 -2
- package/build/tools/getRelatedIssues.d.ts +2 -2
- package/build/tools/getRelatedIssues.js +33 -2
- package/build/tools/getResolutions.d.ts +2 -2
- package/build/tools/getResolutions.js +3 -2
- package/build/tools/getSpace.d.ts +2 -2
- package/build/tools/getSpace.js +13 -2
- package/build/tools/getSpaceActivities.d.ts +2 -2
- package/build/tools/getSpaceActivities.js +12 -2
- package/build/tools/getUserRecentUpdates.d.ts +2 -2
- package/build/tools/getUserRecentUpdates.js +12 -2
- package/build/tools/getUserStarsCount.d.ts +2 -2
- package/build/tools/getUserStarsCount.js +3 -2
- package/build/tools/getUsers.d.ts +2 -2
- package/build/tools/getUsers.js +11 -2
- package/build/tools/getVersionMilestoneList.d.ts +2 -2
- package/build/tools/getVersionMilestoneList.js +12 -2
- package/build/tools/getWatchingListCount.d.ts +2 -2
- package/build/tools/getWatchingListCount.js +5 -2
- package/build/tools/getWatchingListItems.d.ts +2 -2
- package/build/tools/getWatchingListItems.js +12 -2
- package/build/tools/getWiki.d.ts +2 -2
- package/build/tools/getWiki.js +16 -2
- package/build/tools/getWikiPages.d.ts +2 -2
- package/build/tools/getWikiPages.js +12 -2
- package/build/tools/getWikisCount.d.ts +2 -2
- package/build/tools/getWikisCount.js +3 -2
- package/build/tools/markNotificationAsRead.d.ts +6 -1
- package/build/tools/markNotificationAsRead.js +6 -1
- package/build/tools/markWatchingAsRead.d.ts +6 -1
- package/build/tools/markWatchingAsRead.js +6 -1
- package/build/tools/removeRelatedIssue.d.ts +2 -2
- package/build/tools/removeRelatedIssue.js +33 -2
- package/build/tools/resetUnreadNotificationCount.d.ts +2 -2
- package/build/tools/resetUnreadNotificationCount.js +5 -2
- package/build/tools/updateIssue.d.ts +2 -2
- package/build/tools/updateIssue.js +32 -2
- package/build/tools/updateIssueComment.d.ts +2 -2
- package/build/tools/updateIssueComment.js +14 -2
- package/build/tools/updateProject.d.ts +2 -2
- package/build/tools/updateProject.js +22 -2
- package/build/tools/updatePullRequest.d.ts +2 -2
- package/build/tools/updatePullRequest.js +26 -2
- package/build/tools/updatePullRequestComment.d.ts +2 -2
- package/build/tools/updatePullRequestComment.js +12 -2
- package/build/tools/updateVersionMilestone.d.ts +2 -2
- package/build/tools/updateVersionMilestone.js +12 -2
- package/build/tools/updateWatching.d.ts +2 -2
- package/build/tools/updateWatching.js +12 -2
- package/build/tools/updateWiki.d.ts +2 -2
- package/build/tools/updateWiki.js +16 -2
- package/build/types/outputFields.d.ts +26 -0
- package/build/types/outputFields.js +3 -0
- package/build/types/tool.d.ts +21 -8
- package/build/types/zod/activityType.d.ts +38 -0
- package/build/types/zod/activityType.js +38 -0
- package/build/utils/fieldSelection.d.ts +22 -0
- package/build/utils/fieldSelection.js +40 -0
- package/build/utils/toolsetUtils.d.ts +1 -3
- package/build/utils/toolsetUtils.js +0 -12
- package/package.json +4 -4
- package/build/tools/dynamicTools/toolsets.d.ts +0 -15
- package/build/tools/dynamicTools/toolsets.js +0 -103
- package/build/types/zod/backlogOutputDefinition.d.ts +0 -3334
- package/build/types/zod/backlogOutputDefinition.js +0 -483
- package/build/utils/generateFieldsDescription.d.ts +0 -5
- package/build/utils/generateFieldsDescription.js +0 -50
- package/build/utils/toolRegistrar.d.ts +0 -5
- package/build/utils/toolRegistrar.js +0 -12
package/build/types/tool.d.ts
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
3
3
|
import { CallToolResult } from '@modelcontextprotocol/server';
|
|
4
|
-
export type ToolDefinition<Shape extends z.ZodRawShape,
|
|
4
|
+
export type ToolDefinition<Shape extends z.ZodRawShape, Result> = {
|
|
5
5
|
name: string;
|
|
6
6
|
description: string;
|
|
7
7
|
schema: z.ZodObject<Shape>;
|
|
8
|
-
|
|
8
|
+
outputFields: readonly (keyof Result)[];
|
|
9
9
|
handler: (input: z.infer<z.ZodObject<Shape>> & {
|
|
10
|
-
fields?: string;
|
|
10
|
+
fields?: string[];
|
|
11
11
|
organization?: string;
|
|
12
|
-
}) => Promise<
|
|
13
|
-
importantFields?: (keyof
|
|
12
|
+
}) => Promise<Result | Result[]>;
|
|
13
|
+
importantFields?: (keyof Result)[];
|
|
14
|
+
/**
|
|
15
|
+
* Whether the Backlog call behind this tool returns a list.
|
|
16
|
+
*
|
|
17
|
+
* `--optimize-response` only publishes its `fields` parameter on these. A list
|
|
18
|
+
* is the case where the response grows without bound — `get_issues` alone
|
|
19
|
+
* returns up to 100 issues — and where trimming it is worth the schema every
|
|
20
|
+
* client downloads. A tool that returns one record saves a few hundred bytes at
|
|
21
|
+
* best, against a cost paid on every session by everyone.
|
|
22
|
+
*
|
|
23
|
+
* Verifiable: it is true exactly for the tools whose `backlog-js` method is
|
|
24
|
+
* declared as `Promise<T[]>`.
|
|
25
|
+
*
|
|
26
|
+
* Required rather than optional so that a new tool has to answer the question.
|
|
27
|
+
* Left optional, forgetting it would silently mean "no field selection".
|
|
28
|
+
*/
|
|
29
|
+
returnsList: boolean;
|
|
14
30
|
};
|
|
15
31
|
export declare const buildToolSchema: <T extends z.ZodRawShape>(fn: (t: DescriptionHelper["t"]) => T) => (t: DescriptionHelper["t"]) => T;
|
|
16
32
|
export type DynamicToolDefinition<Shape extends z.ZodRawShape> = {
|
|
@@ -19,6 +35,3 @@ export type DynamicToolDefinition<Shape extends z.ZodRawShape> = {
|
|
|
19
35
|
schema: z.ZodObject<Shape>;
|
|
20
36
|
handler: (input: z.infer<z.ZodObject<Shape>>) => Promise<CallToolResult>;
|
|
21
37
|
};
|
|
22
|
-
export interface ToolRegistrar {
|
|
23
|
-
enableToolsetAndRefresh(toolset: string): Promise<string>;
|
|
24
|
-
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The activity type ids the Backlog API accepts as a filter.
|
|
4
|
+
*
|
|
5
|
+
* All that is left of backlogOutputDefinition.ts. That file described API
|
|
6
|
+
* responses in parallel with the types backlog-js already ships; tools now take
|
|
7
|
+
* their field names from those types instead. This one is different: it is an
|
|
8
|
+
* input filter, and backlog-js has no enum for it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ActivityTypeSchema: z.ZodEnum<{
|
|
11
|
+
Undefined: number;
|
|
12
|
+
IssueCreated: number;
|
|
13
|
+
IssueUpdated: number;
|
|
14
|
+
IssueCommented: number;
|
|
15
|
+
IssueDeleted: number;
|
|
16
|
+
WikiCreated: number;
|
|
17
|
+
WikiUpdated: number;
|
|
18
|
+
WikiDeleted: number;
|
|
19
|
+
FileAdded: number;
|
|
20
|
+
FileUpdated: number;
|
|
21
|
+
FileDeleted: number;
|
|
22
|
+
SvnCommitted: number;
|
|
23
|
+
GitPushed: number;
|
|
24
|
+
GitRepositoryCreated: number;
|
|
25
|
+
IssueMultiUpdated: number;
|
|
26
|
+
ProjectUserAdded: number;
|
|
27
|
+
ProjectUserRemoved: number;
|
|
28
|
+
NotifyAdded: number;
|
|
29
|
+
PullRequestAdded: number;
|
|
30
|
+
PullRequestUpdated: number;
|
|
31
|
+
PullRequestCommented: number;
|
|
32
|
+
PullRequestMerged: number;
|
|
33
|
+
MilestoneCreated: number;
|
|
34
|
+
MilestoneUpdated: number;
|
|
35
|
+
MilestoneDeleted: number;
|
|
36
|
+
ProjectGroupAdded: number;
|
|
37
|
+
ProjectGroupDeleted: number;
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The activity type ids the Backlog API accepts as a filter.
|
|
4
|
+
*
|
|
5
|
+
* All that is left of backlogOutputDefinition.ts. That file described API
|
|
6
|
+
* responses in parallel with the types backlog-js already ships; tools now take
|
|
7
|
+
* their field names from those types instead. This one is different: it is an
|
|
8
|
+
* input filter, and backlog-js has no enum for it.
|
|
9
|
+
*/
|
|
10
|
+
export const ActivityTypeSchema = z.nativeEnum({
|
|
11
|
+
Undefined: -1,
|
|
12
|
+
IssueCreated: 1,
|
|
13
|
+
IssueUpdated: 2,
|
|
14
|
+
IssueCommented: 3,
|
|
15
|
+
IssueDeleted: 4,
|
|
16
|
+
WikiCreated: 5,
|
|
17
|
+
WikiUpdated: 6,
|
|
18
|
+
WikiDeleted: 7,
|
|
19
|
+
FileAdded: 8,
|
|
20
|
+
FileUpdated: 9,
|
|
21
|
+
FileDeleted: 10,
|
|
22
|
+
SvnCommitted: 11,
|
|
23
|
+
GitPushed: 12,
|
|
24
|
+
GitRepositoryCreated: 13,
|
|
25
|
+
IssueMultiUpdated: 14,
|
|
26
|
+
ProjectUserAdded: 15,
|
|
27
|
+
ProjectUserRemoved: 16,
|
|
28
|
+
NotifyAdded: 17,
|
|
29
|
+
PullRequestAdded: 18,
|
|
30
|
+
PullRequestUpdated: 19,
|
|
31
|
+
PullRequestCommented: 20,
|
|
32
|
+
PullRequestMerged: 21,
|
|
33
|
+
MilestoneCreated: 22,
|
|
34
|
+
MilestoneUpdated: 23,
|
|
35
|
+
MilestoneDeleted: 24,
|
|
36
|
+
ProjectGroupAdded: 25,
|
|
37
|
+
ProjectGroupDeleted: 26,
|
|
38
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Describes the `fields` parameter that `--optimize-response` adds to a tool.
|
|
4
|
+
*
|
|
5
|
+
* The selectable names come straight from the tool's `outputFields`, so they are
|
|
6
|
+
* published as a JSON Schema enum rather than described in prose. That is the
|
|
7
|
+
* whole point of the shape: the enum *is* the documentation, an unknown name is
|
|
8
|
+
* rejected by schema validation instead of being silently dropped, and the text
|
|
9
|
+
* shrinks to one sentence per tool.
|
|
10
|
+
*
|
|
11
|
+
* Selection is one level deep. It used to accept a GraphQL selection set, parsed
|
|
12
|
+
* with the `graphql` package, which cost ~1 MB for one `parse` call and accepted
|
|
13
|
+
* far more of the grammar than was ever honoured — aliases, fragments, arguments
|
|
14
|
+
* and directives all parsed and were then quietly ignored, and descending into an
|
|
15
|
+
* array field returned `{}` and lost the data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fieldSelection(outputFields: readonly PropertyKey[], importantFields?: readonly PropertyKey[]): {
|
|
18
|
+
names: string[];
|
|
19
|
+
description: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
/** The `fields` parameter itself, or undefined when the tool has nothing to offer. */
|
|
22
|
+
export declare function fieldSelectionSchema(outputFields: readonly PropertyKey[], importantFields?: readonly PropertyKey[]): z.ZodOptional<z.ZodArray<z.ZodEnum<Record<string, string>>>> | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Describes the `fields` parameter that `--optimize-response` adds to a tool.
|
|
4
|
+
*
|
|
5
|
+
* The selectable names come straight from the tool's `outputFields`, so they are
|
|
6
|
+
* published as a JSON Schema enum rather than described in prose. That is the
|
|
7
|
+
* whole point of the shape: the enum *is* the documentation, an unknown name is
|
|
8
|
+
* rejected by schema validation instead of being silently dropped, and the text
|
|
9
|
+
* shrinks to one sentence per tool.
|
|
10
|
+
*
|
|
11
|
+
* Selection is one level deep. It used to accept a GraphQL selection set, parsed
|
|
12
|
+
* with the `graphql` package, which cost ~1 MB for one `parse` call and accepted
|
|
13
|
+
* far more of the grammar than was ever honoured — aliases, fragments, arguments
|
|
14
|
+
* and directives all parsed and were then quietly ignored, and descending into an
|
|
15
|
+
* array field returned `{}` and lost the data.
|
|
16
|
+
*/
|
|
17
|
+
export function fieldSelection(outputFields, importantFields = []) {
|
|
18
|
+
// `keyof T` admits numbers and symbols. Entity keys are all strings, but taking
|
|
19
|
+
// PropertyKey here keeps the caller from having to assert that.
|
|
20
|
+
const names = outputFields.map(String);
|
|
21
|
+
// `z.enum([])` is not constructible, and a tool with no known output fields has
|
|
22
|
+
// nothing to select from anyway.
|
|
23
|
+
if (names.length === 0)
|
|
24
|
+
return undefined;
|
|
25
|
+
const useful = importantFields.map(String).filter((f) => names.includes(f));
|
|
26
|
+
const description = useful.length > 0
|
|
27
|
+
? `Return only these fields of the result, to keep the response small. Most callers want: ${useful.join(', ')}.`
|
|
28
|
+
: 'Return only these fields of the result, to keep the response small.';
|
|
29
|
+
return { names, description };
|
|
30
|
+
}
|
|
31
|
+
/** The `fields` parameter itself, or undefined when the tool has nothing to offer. */
|
|
32
|
+
export function fieldSelectionSchema(outputFields, importantFields = []) {
|
|
33
|
+
const selection = fieldSelection(outputFields, importantFields);
|
|
34
|
+
if (!selection)
|
|
35
|
+
return undefined;
|
|
36
|
+
return z
|
|
37
|
+
.array(z.enum(selection.names))
|
|
38
|
+
.optional()
|
|
39
|
+
.describe(selection.description);
|
|
40
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Backlog } from 'backlog-js';
|
|
2
|
-
import { ToolsetGroup
|
|
2
|
+
import { ToolsetGroup } from '../types/toolsets.js';
|
|
3
3
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
4
|
-
export declare function getToolset(group: ToolsetGroup, name: string): Toolset | undefined;
|
|
5
|
-
export declare function enableToolset(group: ToolsetGroup, name: string): string;
|
|
6
4
|
export declare const buildToolsetGroup: (backlog: Backlog, helper: DescriptionHelper, enabledToolsets: string[]) => ToolsetGroup;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { allTools } from '../tools/tools.js';
|
|
2
|
-
export function getToolset(group, name) {
|
|
3
|
-
return group.toolsets.find((t) => t.name === name);
|
|
4
|
-
}
|
|
5
|
-
export function enableToolset(group, name) {
|
|
6
|
-
const ts = getToolset(group, name);
|
|
7
|
-
if (!ts)
|
|
8
|
-
return `Toolset ${name} not found`;
|
|
9
|
-
if (ts.enabled)
|
|
10
|
-
return `Toolset ${name} is already enabled`;
|
|
11
|
-
ts.enabled = true;
|
|
12
|
-
return `Toolset ${name} enabled`;
|
|
13
|
-
}
|
|
14
2
|
export const buildToolsetGroup = (backlog, helper, enabledToolsets) => {
|
|
15
3
|
const toolsetGroup = allTools(backlog, helper);
|
|
16
4
|
const knownNames = toolsetGroup.toolsets.map((ts) => ts.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backlog-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"backlog-mcp-server": "./build/index.js"
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"@modelcontextprotocol/hono": "^2.0.0",
|
|
38
38
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
39
39
|
"backlog-js": "^0.19.1",
|
|
40
|
-
"cosmiconfig": "^9.0.1",
|
|
41
40
|
"env-var": "^7.5.0",
|
|
42
|
-
"graphql": "^16.14.1",
|
|
43
41
|
"hono": "^4.12.34",
|
|
42
|
+
"js-yaml": "^5.2.3",
|
|
44
43
|
"pino": "^10.3.1",
|
|
45
44
|
"yargs": "^18.0.0",
|
|
46
45
|
"zod": "^4.4.3"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@eslint/js": "^10.0.1",
|
|
50
|
-
"@types/
|
|
49
|
+
"@types/js-yaml": "^4.0.9",
|
|
50
|
+
"@types/node": "^26.2.0",
|
|
51
51
|
"@types/yargs": "^17.0.35",
|
|
52
52
|
"@typescript-eslint/eslint-plugin": "^8.60.1",
|
|
53
53
|
"@typescript-eslint/parser": "^8.60.1",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { DynamicToolDefinition, ToolRegistrar } from '../../types/tool.js';
|
|
3
|
-
import { DynamicToolsetGroup, ToolsetGroup } from '../../types/toolsets.js';
|
|
4
|
-
import { DescriptionHelper } from '../../createDescriptionHelper.js';
|
|
5
|
-
export declare const dynamicTools: (toolRegistrar: ToolRegistrar, helper: DescriptionHelper, toolsetGroup: ToolsetGroup) => DynamicToolsetGroup;
|
|
6
|
-
declare const enableToolsetSchema: (t: DescriptionHelper["t"]) => {
|
|
7
|
-
toolset: z.ZodString;
|
|
8
|
-
};
|
|
9
|
-
export declare const enableToolsetTool: (toolRegistrar: ToolRegistrar, { t }: DescriptionHelper) => DynamicToolDefinition<ReturnType<typeof enableToolsetSchema>>;
|
|
10
|
-
export declare const listAvailableToolsets: ({ t }: DescriptionHelper, toolsetGroup: ToolsetGroup) => DynamicToolDefinition<Record<string, never>>;
|
|
11
|
-
declare const getToolsetToolsSchema: (t: DescriptionHelper["t"]) => {
|
|
12
|
-
toolset: z.ZodString;
|
|
13
|
-
};
|
|
14
|
-
export declare const getToolsetTools: ({ t }: DescriptionHelper, toolsetGroup: ToolsetGroup) => DynamicToolDefinition<ReturnType<typeof getToolsetToolsSchema>>;
|
|
15
|
-
export {};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema, } from '../../types/tool.js';
|
|
3
|
-
export const dynamicTools = function (toolRegistrar, helper, toolsetGroup) {
|
|
4
|
-
return {
|
|
5
|
-
toolsets: [
|
|
6
|
-
{
|
|
7
|
-
name: 'dynamic_tools',
|
|
8
|
-
description: 'Tools for managing Backlog space settings and general information.',
|
|
9
|
-
enabled: true,
|
|
10
|
-
tools: [
|
|
11
|
-
enableToolsetTool(toolRegistrar, helper),
|
|
12
|
-
listAvailableToolsets(helper, toolsetGroup),
|
|
13
|
-
getToolsetTools(helper, toolsetGroup),
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
const enableToolsetSchema = buildToolSchema((t) => ({
|
|
20
|
-
toolset: z
|
|
21
|
-
.string()
|
|
22
|
-
.describe(t('TOOL_ENABLE_TOOLSET_TOOLSET', 'Enable a toolset')),
|
|
23
|
-
}));
|
|
24
|
-
export const enableToolsetTool = (toolRegistrar, { t }) => {
|
|
25
|
-
return {
|
|
26
|
-
name: 'enable_toolset',
|
|
27
|
-
description: t('TOOL_ENABLE_TOOLSET_DESCRIPTION', 'Enable one of the Backlog MCP server toolsets. Use get_toolset_tools and list_available_toolsets first to inspect what this will enable.'),
|
|
28
|
-
schema: z.object(enableToolsetSchema(t)),
|
|
29
|
-
handler: async ({ toolset }) => {
|
|
30
|
-
const msg = await toolRegistrar.enableToolsetAndRefresh(toolset);
|
|
31
|
-
return {
|
|
32
|
-
content: [
|
|
33
|
-
{
|
|
34
|
-
type: 'text',
|
|
35
|
-
text: msg,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export const listAvailableToolsets = ({ t }, toolsetGroup) => {
|
|
43
|
-
return {
|
|
44
|
-
name: 'list_available_toolsets',
|
|
45
|
-
description: t('TOOL_LIST_AVAILABLE_TOOLSETS_DESCRIPTION', 'List all available toolsets.'),
|
|
46
|
-
schema: z.object({}),
|
|
47
|
-
handler: async () => {
|
|
48
|
-
const result = toolsetGroup.toolsets.map((ts) => ({
|
|
49
|
-
name: ts.name,
|
|
50
|
-
description: ts.description,
|
|
51
|
-
currentlyEnabled: ts.enabled,
|
|
52
|
-
canEnable: true,
|
|
53
|
-
}));
|
|
54
|
-
return {
|
|
55
|
-
content: [
|
|
56
|
-
{
|
|
57
|
-
type: 'text',
|
|
58
|
-
text: JSON.stringify(result, null, 2),
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
const getToolsetToolsSchema = buildToolSchema((t) => ({
|
|
66
|
-
toolset: z
|
|
67
|
-
.string()
|
|
68
|
-
.describe(t('TOOL_GET_TOOLSET_TOOLS_TOOLSET', 'Toolset name to inspect')),
|
|
69
|
-
}));
|
|
70
|
-
export const getToolsetTools = ({ t }, toolsetGroup) => {
|
|
71
|
-
return {
|
|
72
|
-
name: 'get_toolset_tools',
|
|
73
|
-
description: t('TOOL_GET_TOOLSET_TOOLS_DESCRIPTION', 'List all tools in a specific toolset.'),
|
|
74
|
-
schema: z.object(getToolsetToolsSchema(t)),
|
|
75
|
-
handler: async ({ toolset }) => {
|
|
76
|
-
const found = toolsetGroup.toolsets.find((ts) => ts.name === toolset);
|
|
77
|
-
if (!found) {
|
|
78
|
-
return {
|
|
79
|
-
content: [
|
|
80
|
-
{
|
|
81
|
-
type: 'text',
|
|
82
|
-
text: `Toolset '${toolset}' not found.`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const tools = found.tools.map((tool) => ({
|
|
88
|
-
name: tool.name,
|
|
89
|
-
description: tool.description,
|
|
90
|
-
toolset: found.name,
|
|
91
|
-
canEnable: true,
|
|
92
|
-
}));
|
|
93
|
-
return {
|
|
94
|
-
content: [
|
|
95
|
-
{
|
|
96
|
-
type: 'text',
|
|
97
|
-
text: JSON.stringify(tools, null, 2),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
};
|