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
|
@@ -1,24 +1,86 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { load } from 'js-yaml';
|
|
2
3
|
import os from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { logger } from './utils/logger.js';
|
|
3
6
|
/**
|
|
4
|
-
* Reads description overrides from a `.backlog-mcp-serverrc` file
|
|
5
|
-
*
|
|
7
|
+
* Reads description overrides from a `.backlog-mcp-serverrc` file in the user's
|
|
8
|
+
* home directory.
|
|
6
9
|
*
|
|
7
10
|
* Node-only, and kept separate from `createDescriptionHelper` for that reason:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* this reads the filesystem and needs a home directory. The CLI calls it and
|
|
12
|
+
* hands the result to the helper.
|
|
10
13
|
*
|
|
11
14
|
* The file is user-authored, so its contents are unknown: anything that is not a
|
|
12
15
|
* string is dropped here rather than passed on. Most overrides end up in a tool
|
|
13
16
|
* description, and a number or an array there would produce an invalid
|
|
14
17
|
* `tools/list` payload.
|
|
18
|
+
*
|
|
19
|
+
* A file that exists but cannot be parsed is reported and then ignored.
|
|
20
|
+
* Overriding descriptions is an add-on, and a trailing comma in an optional file
|
|
21
|
+
* is not a reason to stop serving the tools — from the client's side an
|
|
22
|
+
* exception here looks like "the MCP server will not connect", with nothing
|
|
23
|
+
* pointing at the config file.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Checked in this order; the first one that exists wins. The extensionless form
|
|
27
|
+
* is parsed as YAML, which also accepts JSON.
|
|
28
|
+
*/
|
|
29
|
+
const SUFFIXES = ['', '.json', '.yaml', '.yml'];
|
|
30
|
+
/**
|
|
31
|
+
* A missing candidate is not a failure — there are four of them and at most one
|
|
32
|
+
* exists. A candidate that exists but does not parse is, and has to be
|
|
33
|
+
* distinguished from the missing case so it can be reported rather than skipped.
|
|
15
34
|
*/
|
|
35
|
+
function readCandidate(filePath) {
|
|
36
|
+
let raw;
|
|
37
|
+
try {
|
|
38
|
+
raw = readFileSync(filePath, 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof Error &&
|
|
42
|
+
'code' in error &&
|
|
43
|
+
(error.code === 'ENOENT' || error.code === 'ENOTDIR')) {
|
|
44
|
+
return { status: 'absent' };
|
|
45
|
+
}
|
|
46
|
+
return { status: 'unreadable', error };
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
// An empty file is a config file with nothing in it, not a parse failure.
|
|
50
|
+
// `JSON.parse('')` throws, so it never reaches the caller's object check.
|
|
51
|
+
if (raw.trim() === '')
|
|
52
|
+
return { status: 'found', config: undefined };
|
|
53
|
+
return {
|
|
54
|
+
status: 'found',
|
|
55
|
+
config: filePath.endsWith('.json') ? JSON.parse(raw) : load(raw),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return { status: 'unreadable', error };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
16
62
|
export function loadDescriptionOverrides(options) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
63
|
+
const configName = options?.configName ?? 'backlog-mcp-server';
|
|
64
|
+
const searchDir = options?.searchDir ?? os.homedir();
|
|
65
|
+
for (const suffix of SUFFIXES) {
|
|
66
|
+
const filePath = path.join(searchDir, `.${configName}rc${suffix}`);
|
|
67
|
+
const outcome = readCandidate(filePath);
|
|
68
|
+
if (outcome.status === 'absent')
|
|
69
|
+
continue;
|
|
70
|
+
if (outcome.status === 'unreadable') {
|
|
71
|
+
// `logger.error`, not `warn`: the logger runs at level `error` unless
|
|
72
|
+
// NODE_ENV says otherwise, so a warning here would never reach the user
|
|
73
|
+
// this message exists for.
|
|
74
|
+
logger.error({ err: outcome.error, filePath }, 'Could not read the description override file; continuing with the built-in defaults');
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
const config = outcome.config;
|
|
78
|
+
if (typeof config !== 'object' ||
|
|
79
|
+
config === null ||
|
|
80
|
+
Array.isArray(config)) {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
return Object.fromEntries(Object.entries(config).filter(([, value]) => typeof value === 'string'));
|
|
22
84
|
}
|
|
23
|
-
return
|
|
85
|
+
return {};
|
|
24
86
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Backlog } from 'backlog-js';
|
|
2
|
+
import type { MCPOptions } from './types/mcp.js';
|
|
3
|
+
import type { BacklogClientRegistry } from './utils/backlogClientRegistry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reports override keys in the config file that no tool or parameter asks for.
|
|
6
|
+
*
|
|
7
|
+
* The override keys are an untyped, unversioned public API: rename one in the
|
|
8
|
+
* source and every user's override for it stops applying, falls back to the
|
|
9
|
+
* built-in default, and says nothing. The user sees "I configured this and it
|
|
10
|
+
* has no effect". This turns that into a line in the server log.
|
|
11
|
+
*
|
|
12
|
+
* The comparison is exact, which also catches keys written in the wrong case —
|
|
13
|
+
* `t()` looks up `key.toUpperCase()`, so a lower-case entry in the config file
|
|
14
|
+
* never matches anything either.
|
|
15
|
+
*/
|
|
16
|
+
export declare function reportUnknownOverrideKeys({ overrides, version, backlog, clientRegistry, mcpOption, }: {
|
|
17
|
+
overrides: Record<string, string>;
|
|
18
|
+
version: string;
|
|
19
|
+
backlog: Backlog;
|
|
20
|
+
clientRegistry: BacklogClientRegistry;
|
|
21
|
+
mcpOption: MCPOptions;
|
|
22
|
+
}): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createBacklogMcpServer } from './createBacklogMcpServer.js';
|
|
2
|
+
import { createDescriptionHelper } from './createDescriptionHelper.js';
|
|
3
|
+
import { logger } from './utils/logger.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reports override keys in the config file that no tool or parameter asks for.
|
|
6
|
+
*
|
|
7
|
+
* The override keys are an untyped, unversioned public API: rename one in the
|
|
8
|
+
* source and every user's override for it stops applying, falls back to the
|
|
9
|
+
* built-in default, and says nothing. The user sees "I configured this and it
|
|
10
|
+
* has no effect". This turns that into a line in the server log.
|
|
11
|
+
*
|
|
12
|
+
* The comparison is exact, which also catches keys written in the wrong case —
|
|
13
|
+
* `t()` looks up `key.toUpperCase()`, so a lower-case entry in the config file
|
|
14
|
+
* never matches anything either.
|
|
15
|
+
*/
|
|
16
|
+
export function reportUnknownOverrideKeys({ overrides, version, backlog, clientRegistry, mcpOption, }) {
|
|
17
|
+
const configured = Object.keys(overrides);
|
|
18
|
+
if (configured.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
// Keys are only recorded once a tool asks for them, so the set of valid keys
|
|
21
|
+
// is whatever building the full tool list touches. This is a throwaway helper
|
|
22
|
+
// and server built purely to collect them: the real ones may have toolsets
|
|
23
|
+
// disabled, and their keys would then look unknown. ~17ms, and only for users
|
|
24
|
+
// who actually have a config file.
|
|
25
|
+
const probe = createDescriptionHelper();
|
|
26
|
+
createBacklogMcpServer({
|
|
27
|
+
version,
|
|
28
|
+
useFields: mcpOption.useFields,
|
|
29
|
+
backlog,
|
|
30
|
+
clientRegistry,
|
|
31
|
+
descriptionHelper: probe,
|
|
32
|
+
enabledToolsets: ['all'],
|
|
33
|
+
mcpOption: { ...mcpOption, useOrganization: true },
|
|
34
|
+
});
|
|
35
|
+
const known = new Set(Object.keys(probe.dump()));
|
|
36
|
+
const unknown = configured.filter((key) => !known.has(key));
|
|
37
|
+
if (unknown.length === 0)
|
|
38
|
+
return;
|
|
39
|
+
// `error`, not `warn`: the logger drops anything below error in the default
|
|
40
|
+
// configuration, which is what users run.
|
|
41
|
+
logger.error({ keys: unknown }, 'These description override keys match no tool or parameter and had no effect');
|
|
42
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Entity } from 'backlog-js';
|
|
1
2
|
import { Backlog } from 'backlog-js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
4
|
-
import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
5
5
|
import { ToolDefinition } from '../types/tool.js';
|
|
6
6
|
declare const addDocumentSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
projectId: z.ZodNumber;
|
|
@@ -11,5 +11,5 @@ declare const addDocumentSchema: (t: DescriptionHelper["t"]) => {
|
|
|
11
11
|
parentId: z.ZodOptional<z.ZodString>;
|
|
12
12
|
addLast: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
};
|
|
14
|
-
export declare const addDocumentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addDocumentSchema>,
|
|
14
|
+
export declare const addDocumentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addDocumentSchema>, Entity.Document.Document>;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
3
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
const addDocumentSchema = buildToolSchema((t) => ({
|
|
5
5
|
projectId: z
|
|
6
6
|
.number()
|
|
@@ -31,7 +31,22 @@ export const addDocumentTool = (backlog, { t }) => {
|
|
|
31
31
|
name: 'addDocument',
|
|
32
32
|
description: t('TOOL_ADD_DOCUMENT_DESCRIPTION', 'Adds a new document to the specified project.'),
|
|
33
33
|
schema: z.object(addDocumentSchema(t)),
|
|
34
|
-
|
|
34
|
+
returnsList: false,
|
|
35
|
+
outputFields: outputFields()([
|
|
36
|
+
'id',
|
|
37
|
+
'projectId',
|
|
38
|
+
'title',
|
|
39
|
+
'plain',
|
|
40
|
+
'json',
|
|
41
|
+
'statusId',
|
|
42
|
+
'emoji',
|
|
43
|
+
'attachments',
|
|
44
|
+
'tags',
|
|
45
|
+
'createdUser',
|
|
46
|
+
'created',
|
|
47
|
+
'updatedUser',
|
|
48
|
+
'updated',
|
|
49
|
+
]),
|
|
35
50
|
importantFields: ['id', 'projectId', 'title', 'plain', 'createdUser'],
|
|
36
51
|
handler: async (params) => {
|
|
37
52
|
return backlog.addDocument(params);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Entity } from 'backlog-js';
|
|
1
2
|
import { Backlog } from 'backlog-js';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
4
|
-
import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
5
5
|
import { ToolDefinition } from '../types/tool.js';
|
|
6
6
|
declare const addIssueSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
projectId: z.ZodNumber;
|
|
@@ -26,5 +26,5 @@ declare const addIssueSchema: (t: DescriptionHelper["t"]) => {
|
|
|
26
26
|
otherValue: z.ZodOptional<z.ZodString>;
|
|
27
27
|
}, z.core.$strip>>>;
|
|
28
28
|
};
|
|
29
|
-
export declare const addIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueSchema>,
|
|
29
|
+
export declare const addIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueSchema>, Entity.Issue.Issue>;
|
|
30
30
|
export {};
|
package/build/tools/addIssue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
3
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { customFieldsToPayload } from '../backlog/customFields.js';
|
|
5
5
|
const addIssueSchema = buildToolSchema((t) => ({
|
|
6
6
|
projectId: z.number().describe(t('TOOL_ADD_ISSUE_PROJECT_ID', 'Project ID')),
|
|
@@ -88,7 +88,37 @@ export const addIssueTool = (backlog, { t }) => {
|
|
|
88
88
|
name: 'add_issue',
|
|
89
89
|
description: t('TOOL_ADD_ISSUE_DESCRIPTION', 'Creates a new issue in the specified project.'),
|
|
90
90
|
schema: z.object(addIssueSchema(t)),
|
|
91
|
-
|
|
91
|
+
returnsList: false,
|
|
92
|
+
outputFields: outputFields()([
|
|
93
|
+
'id',
|
|
94
|
+
'projectId',
|
|
95
|
+
'issueKey',
|
|
96
|
+
'keyId',
|
|
97
|
+
'issueType',
|
|
98
|
+
'summary',
|
|
99
|
+
'description',
|
|
100
|
+
'resolution',
|
|
101
|
+
'priority',
|
|
102
|
+
'status',
|
|
103
|
+
'assignee',
|
|
104
|
+
'category',
|
|
105
|
+
'versions',
|
|
106
|
+
'milestone',
|
|
107
|
+
'startDate',
|
|
108
|
+
'dueDate',
|
|
109
|
+
'estimatedHours',
|
|
110
|
+
'actualHours',
|
|
111
|
+
'parentIssueId',
|
|
112
|
+
'createdUser',
|
|
113
|
+
'created',
|
|
114
|
+
'updatedUser',
|
|
115
|
+
'updated',
|
|
116
|
+
'customFields',
|
|
117
|
+
'attachments',
|
|
118
|
+
'sharedFiles',
|
|
119
|
+
'stars',
|
|
120
|
+
'childIssueSummary',
|
|
121
|
+
]),
|
|
92
122
|
importantFields: ['summary', 'issueKey', 'description', 'createdUser'],
|
|
93
123
|
handler: async ({ customFields, ...params }) => {
|
|
94
124
|
const customFieldPayload = customFieldsToPayload(customFields);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addIssueCommentSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
issueId: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
issueKey: z.ZodOptional<z.ZodString>;
|
|
@@ -10,5 +10,5 @@ declare const addIssueCommentSchema: (t: DescriptionHelper["t"]) => {
|
|
|
10
10
|
notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
11
11
|
attachmentId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
12
12
|
};
|
|
13
|
-
export declare const addIssueCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueCommentSchema>,
|
|
13
|
+
export declare const addIssueCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addIssueCommentSchema>, Entity.Issue.Comment>;
|
|
14
14
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
5
|
const addIssueCommentSchema = buildToolSchema((t) => ({
|
|
6
6
|
issueId: z
|
|
@@ -28,7 +28,19 @@ export const addIssueCommentTool = (backlog, { t }) => {
|
|
|
28
28
|
name: 'add_issue_comment',
|
|
29
29
|
description: t('TOOL_ADD_ISSUE_COMMENT_DESCRIPTION', 'Adds a comment to an issue'),
|
|
30
30
|
schema: z.object(addIssueCommentSchema(t)),
|
|
31
|
-
|
|
31
|
+
returnsList: false,
|
|
32
|
+
outputFields: outputFields()([
|
|
33
|
+
'id',
|
|
34
|
+
'projectId',
|
|
35
|
+
'issueId',
|
|
36
|
+
'content',
|
|
37
|
+
'changeLog',
|
|
38
|
+
'createdUser',
|
|
39
|
+
'created',
|
|
40
|
+
'updated',
|
|
41
|
+
'stars',
|
|
42
|
+
'notifications',
|
|
43
|
+
]),
|
|
32
44
|
handler: async ({ issueId, issueKey, content, notifiedUserId, attachmentId, }) => {
|
|
33
45
|
const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
|
|
34
46
|
if (!result.ok) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addProjectSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
name: z.ZodString;
|
|
8
8
|
key: z.ZodString;
|
|
@@ -14,5 +14,5 @@ declare const addProjectSchema: (t: DescriptionHelper["t"]) => {
|
|
|
14
14
|
markdown: "markdown";
|
|
15
15
|
}>>;
|
|
16
16
|
};
|
|
17
|
-
export declare const addProjectTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addProjectSchema>,
|
|
17
|
+
export declare const addProjectTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addProjectSchema>, Entity.Project.Project>;
|
|
18
18
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
const addProjectSchema = buildToolSchema((t) => ({
|
|
5
5
|
name: z.string().describe(t('TOOL_ADD_PROJECT_NAME', 'Project name')),
|
|
6
6
|
key: z.string().describe(t('TOOL_ADD_PROJECT_KEY', 'Project key')),
|
|
@@ -26,7 +26,27 @@ export const addProjectTool = (backlog, { t }) => {
|
|
|
26
26
|
name: 'add_project',
|
|
27
27
|
description: t('TOOL_ADD_PROJECT_DESCRIPTION', 'Creates a new project'),
|
|
28
28
|
schema: z.object(addProjectSchema(t)),
|
|
29
|
-
|
|
29
|
+
returnsList: false,
|
|
30
|
+
outputFields: outputFields()([
|
|
31
|
+
'id',
|
|
32
|
+
'projectKey',
|
|
33
|
+
'name',
|
|
34
|
+
'chartEnabled',
|
|
35
|
+
'useResolvedForChart',
|
|
36
|
+
'subtaskingEnabled',
|
|
37
|
+
'projectLeaderCanEditProjectLeader',
|
|
38
|
+
'useWiki',
|
|
39
|
+
'useFileSharing',
|
|
40
|
+
'useWikiTreeView',
|
|
41
|
+
'useOriginalImageSizeAtWiki',
|
|
42
|
+
'useSubversion',
|
|
43
|
+
'useGit',
|
|
44
|
+
'textFormattingRule',
|
|
45
|
+
'archived',
|
|
46
|
+
'displayOrder',
|
|
47
|
+
'useDevAttributes',
|
|
48
|
+
'grandchildIssueEnabled',
|
|
49
|
+
]),
|
|
30
50
|
handler: async ({ name, key, chartEnabled, subtaskingEnabled, projectLeaderCanEditProjectLeader, textFormattingRule, }) => backlog.postProject({
|
|
31
51
|
name,
|
|
32
52
|
key,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addPullRequestSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
projectId: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
projectKey: z.ZodOptional<z.ZodString>;
|
|
@@ -16,5 +16,5 @@ declare const addPullRequestSchema: (t: DescriptionHelper["t"]) => {
|
|
|
16
16
|
assigneeId: z.ZodOptional<z.ZodNumber>;
|
|
17
17
|
notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
18
18
|
};
|
|
19
|
-
export declare const addPullRequestTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestSchema>,
|
|
19
|
+
export declare const addPullRequestTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestSchema>, Entity.PullRequest.PullRequest>;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
5
|
const addPullRequestSchema = buildToolSchema((t) => ({
|
|
6
6
|
projectId: z
|
|
@@ -49,7 +49,31 @@ export const addPullRequestTool = (backlog, { t }) => {
|
|
|
49
49
|
name: 'add_pull_request',
|
|
50
50
|
description: t('TOOL_ADD_PULL_REQUEST_DESCRIPTION', 'Creates a new pull request'),
|
|
51
51
|
schema: z.object(addPullRequestSchema(t)),
|
|
52
|
-
|
|
52
|
+
returnsList: false,
|
|
53
|
+
outputFields: outputFields()([
|
|
54
|
+
'id',
|
|
55
|
+
'projectId',
|
|
56
|
+
'repositoryId',
|
|
57
|
+
'number',
|
|
58
|
+
'summary',
|
|
59
|
+
'description',
|
|
60
|
+
'base',
|
|
61
|
+
'branch',
|
|
62
|
+
'status',
|
|
63
|
+
'assignee',
|
|
64
|
+
'issue',
|
|
65
|
+
'baseCommit',
|
|
66
|
+
'branchCommit',
|
|
67
|
+
'mergeCommit',
|
|
68
|
+
'closeAt',
|
|
69
|
+
'mergeAt',
|
|
70
|
+
'createdUser',
|
|
71
|
+
'created',
|
|
72
|
+
'updatedUser',
|
|
73
|
+
'updated',
|
|
74
|
+
'attachments',
|
|
75
|
+
'stars',
|
|
76
|
+
]),
|
|
53
77
|
handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => {
|
|
54
78
|
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
55
79
|
if (!result.ok) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addPullRequestCommentSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
projectId: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
projectKey: z.ZodOptional<z.ZodString>;
|
|
@@ -12,5 +12,5 @@ declare const addPullRequestCommentSchema: (t: DescriptionHelper["t"]) => {
|
|
|
12
12
|
content: z.ZodString;
|
|
13
13
|
notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
14
14
|
};
|
|
15
|
-
export declare const addPullRequestCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestCommentSchema>,
|
|
15
|
+
export declare const addPullRequestCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addPullRequestCommentSchema>, Entity.PullRequest.Comment>;
|
|
16
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
5
|
const addPullRequestCommentSchema = buildToolSchema((t) => ({
|
|
6
6
|
projectId: z
|
|
@@ -35,7 +35,17 @@ export const addPullRequestCommentTool = (backlog, { t }) => {
|
|
|
35
35
|
name: 'add_pull_request_comment',
|
|
36
36
|
description: t('TOOL_ADD_PULL_REQUEST_COMMENT_DESCRIPTION', 'Adds a comment to a pull request'),
|
|
37
37
|
schema: z.object(addPullRequestCommentSchema(t)),
|
|
38
|
-
|
|
38
|
+
returnsList: false,
|
|
39
|
+
outputFields: outputFields()([
|
|
40
|
+
'id',
|
|
41
|
+
'content',
|
|
42
|
+
'changeLog',
|
|
43
|
+
'createdUser',
|
|
44
|
+
'created',
|
|
45
|
+
'updated',
|
|
46
|
+
'stars',
|
|
47
|
+
'notifications',
|
|
48
|
+
]),
|
|
39
49
|
importantFields: ['id', 'content', 'createdUser'],
|
|
40
50
|
handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => {
|
|
41
51
|
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { RelatedIssueSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addRelatedIssueSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
issueId: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
issueKey: z.ZodOptional<z.ZodString>;
|
|
9
9
|
targetIssueId: z.ZodNumber;
|
|
10
10
|
};
|
|
11
|
-
export declare const addRelatedIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addRelatedIssueSchema>,
|
|
11
|
+
export declare const addRelatedIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addRelatedIssueSchema>, Entity.Issue.RelatedIssue>;
|
|
12
12
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
5
|
const addRelatedIssueSchema = buildToolSchema((t) => ({
|
|
6
6
|
issueId: z
|
|
@@ -20,7 +20,38 @@ export const addRelatedIssueTool = (backlog, { t }) => {
|
|
|
20
20
|
name: 'add_related_issue',
|
|
21
21
|
description: t('TOOL_ADD_RELATED_ISSUE_DESCRIPTION', 'Relates an issue to another issue'),
|
|
22
22
|
schema: z.object(addRelatedIssueSchema(t)),
|
|
23
|
-
|
|
23
|
+
returnsList: false,
|
|
24
|
+
outputFields: outputFields()([
|
|
25
|
+
'id',
|
|
26
|
+
'projectId',
|
|
27
|
+
'issueKey',
|
|
28
|
+
'keyId',
|
|
29
|
+
'issueType',
|
|
30
|
+
'summary',
|
|
31
|
+
'description',
|
|
32
|
+
'resolution',
|
|
33
|
+
'priority',
|
|
34
|
+
'status',
|
|
35
|
+
'assignee',
|
|
36
|
+
'category',
|
|
37
|
+
'versions',
|
|
38
|
+
'milestone',
|
|
39
|
+
'startDate',
|
|
40
|
+
'dueDate',
|
|
41
|
+
'estimatedHours',
|
|
42
|
+
'actualHours',
|
|
43
|
+
'parentIssueId',
|
|
44
|
+
'createdUser',
|
|
45
|
+
'created',
|
|
46
|
+
'updatedUser',
|
|
47
|
+
'updated',
|
|
48
|
+
'customFields',
|
|
49
|
+
'attachments',
|
|
50
|
+
'sharedFiles',
|
|
51
|
+
'stars',
|
|
52
|
+
'childIssueSummary',
|
|
53
|
+
'type',
|
|
54
|
+
]),
|
|
24
55
|
handler: async ({ issueId, issueKey, targetIssueId }) => {
|
|
25
56
|
const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
|
|
26
57
|
if (!result.ok) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addVersionMilestoneSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
projectId: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
projectKey: z.ZodOptional<z.ZodString>;
|
|
@@ -11,5 +11,5 @@ declare const addVersionMilestoneSchema: (t: DescriptionHelper["t"]) => {
|
|
|
11
11
|
startDate: z.ZodOptional<z.ZodString>;
|
|
12
12
|
releaseDueDate: z.ZodOptional<z.ZodString>;
|
|
13
13
|
};
|
|
14
|
-
export declare const addVersionMilestoneTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addVersionMilestoneSchema>,
|
|
14
|
+
export declare const addVersionMilestoneTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addVersionMilestoneSchema>, Entity.Project.Version>;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
5
|
const addVersionMilestoneSchema = buildToolSchema((t) => ({
|
|
6
6
|
projectId: z
|
|
@@ -32,7 +32,17 @@ export const addVersionMilestoneTool = (backlog, { t }) => {
|
|
|
32
32
|
name: 'add_version_milestone',
|
|
33
33
|
description: t('TOOL_ADD_VERSION_MILESTONE_DESCRIPTION', 'Creates a new version milestone'),
|
|
34
34
|
schema: z.object(addVersionMilestoneSchema(t)),
|
|
35
|
-
|
|
35
|
+
returnsList: false,
|
|
36
|
+
outputFields: outputFields()([
|
|
37
|
+
'id',
|
|
38
|
+
'projectId',
|
|
39
|
+
'name',
|
|
40
|
+
'description',
|
|
41
|
+
'startDate',
|
|
42
|
+
'releaseDueDate',
|
|
43
|
+
'archived',
|
|
44
|
+
'displayOrder',
|
|
45
|
+
]),
|
|
36
46
|
importantFields: [
|
|
37
47
|
'id',
|
|
38
48
|
'name',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { Entity } from 'backlog-js';
|
|
2
3
|
import { Backlog } from 'backlog-js';
|
|
3
4
|
import { ToolDefinition } from '../types/tool.js';
|
|
4
5
|
import { DescriptionHelper } from '../createDescriptionHelper.js';
|
|
5
|
-
import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
6
6
|
declare const addWatchingSchema: (t: DescriptionHelper["t"]) => {
|
|
7
7
|
issueIdOrKey: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
8
8
|
note: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
9
|
};
|
|
10
|
-
export declare const addWatchingTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWatchingSchema>,
|
|
10
|
+
export declare const addWatchingTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof addWatchingSchema>, Entity.WatchingList.WatchingListItem>;
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFields } from '../types/outputFields.js';
|
|
4
4
|
const addWatchingSchema = buildToolSchema((t) => ({
|
|
5
5
|
issueIdOrKey: z
|
|
6
6
|
.union([z.number(), z.string()])
|
|
@@ -16,7 +16,17 @@ export const addWatchingTool = (backlog, { t }) => {
|
|
|
16
16
|
name: 'add_watching',
|
|
17
17
|
description: t('TOOL_ADD_WATCHING_DESCRIPTION', 'Adds a new watch to an issue'),
|
|
18
18
|
schema: z.object(addWatchingSchema(t)),
|
|
19
|
-
|
|
19
|
+
returnsList: false,
|
|
20
|
+
outputFields: outputFields()([
|
|
21
|
+
'id',
|
|
22
|
+
'resourceAlreadyRead',
|
|
23
|
+
'note',
|
|
24
|
+
'type',
|
|
25
|
+
'issue',
|
|
26
|
+
'lastContentUpdated',
|
|
27
|
+
'created',
|
|
28
|
+
'updated',
|
|
29
|
+
]),
|
|
20
30
|
handler: async ({ issueIdOrKey, note }) => backlog.postWatchingListItem({
|
|
21
31
|
issueIdOrKey,
|
|
22
32
|
note,
|