backlog-mcp-server 0.7.0 → 0.8.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 +89 -41
- package/README.md +102 -43
- package/package.json +15 -10
- package/build/backlog/backlogErrorHandler.js +0 -8
- package/build/backlog/customFields.js +0 -70
- package/build/backlog/parseBacklogAPIError.js +0 -38
- package/build/createTranslationHelper.js +0 -28
- package/build/handlers/builders/composeToolHandler.js +0 -26
- package/build/handlers/transformers/wrapWithErrorHandling.js +0 -4
- package/build/handlers/transformers/wrapWithFieldPicking.js +0 -55
- package/build/handlers/transformers/wrapWithTokenLimit.js +0 -21
- package/build/handlers/transformers/wrapWithToolResult.js +0 -39
- package/build/index.js +0 -101
- package/build/registerTools.js +0 -37
- package/build/tools/addDocument.js +0 -40
- package/build/tools/addIssue.js +0 -97
- package/build/tools/addIssueComment.js +0 -44
- package/build/tools/addProject.js +0 -39
- package/build/tools/addPullRequest.js +0 -65
- package/build/tools/addPullRequestComment.js +0 -52
- package/build/tools/addVersionMilestone.js +0 -51
- package/build/tools/addWatching.js +0 -25
- package/build/tools/addWiki.js +0 -29
- package/build/tools/countIssues.js +0 -105
- package/build/tools/deleteIssue.js +0 -29
- package/build/tools/deleteProject.js +0 -29
- package/build/tools/deleteVersion.js +0 -35
- package/build/tools/deleteWatching.js +0 -17
- package/build/tools/dynamicTools/toolsets.js +0 -103
- package/build/tools/getCategories.js +0 -30
- package/build/tools/getCustomFields.js +0 -37
- package/build/tools/getDocument.js +0 -20
- package/build/tools/getDocumentTree.js +0 -20
- package/build/tools/getDocuments.js +0 -25
- package/build/tools/getGitRepositories.js +0 -29
- package/build/tools/getGitRepository.js +0 -41
- package/build/tools/getIssue.js +0 -29
- package/build/tools/getIssueComments.js +0 -45
- package/build/tools/getIssueTypes.js +0 -30
- package/build/tools/getIssues.js +0 -149
- package/build/tools/getMyself.js +0 -14
- package/build/tools/getNotifications.js +0 -35
- package/build/tools/getNotificationsCount.js +0 -20
- package/build/tools/getPriorities.js +0 -13
- package/build/tools/getProject.js +0 -29
- package/build/tools/getProjectList.js +0 -23
- package/build/tools/getPullRequest.js +0 -44
- package/build/tools/getPullRequestComments.js +0 -60
- package/build/tools/getPullRequests.js +0 -65
- package/build/tools/getPullRequestsCount.js +0 -57
- package/build/tools/getResolutions.js +0 -13
- package/build/tools/getSpace.js +0 -14
- package/build/tools/getUsers.js +0 -14
- package/build/tools/getVersionMilestoneList.js +0 -37
- package/build/tools/getWatchingListCount.js +0 -17
- package/build/tools/getWatchingListItems.js +0 -17
- package/build/tools/getWiki.js +0 -21
- package/build/tools/getWikiPages.js +0 -37
- package/build/tools/getWikisCount.js +0 -29
- package/build/tools/markNotificationAsRead.js +0 -26
- package/build/tools/markWatchingAsRead.js +0 -26
- package/build/tools/resetUnreadNotificationCount.js +0 -13
- package/build/tools/shared/customFieldFiltersSchema.js +0 -78
- package/build/tools/tools.js +0 -163
- package/build/tools/updateIssue.js +0 -119
- package/build/tools/updateProject.js +0 -57
- package/build/tools/updatePullRequest.js +0 -68
- package/build/tools/updatePullRequestComment.js +0 -51
- package/build/tools/updateVersionMilestone.js +0 -57
- package/build/tools/updateWatching.js +0 -18
- package/build/tools/updateWiki.js +0 -37
- package/build/types/mcp.js +0 -1
- package/build/types/result.js +0 -3
- package/build/types/tool.js +0 -1
- package/build/types/toolsets.js +0 -1
- package/build/types/zod/backlogOutputDefinition.js +0 -468
- package/build/utils/generateFieldsDescription.js +0 -47
- package/build/utils/logger.js +0 -20
- package/build/utils/resolveIdOrKey.js +0 -25
- package/build/utils/runToolSafely.js +0 -18
- package/build/utils/tokenCounter.js +0 -11
- package/build/utils/toolRegistrar.js +0 -12
- package/build/utils/toolsetUtils.js +0 -48
- package/build/utils/wrapServerWithToolRegistry.js +0 -16
- package/build/version.js +0 -1
- package/build/version.template.js +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { DocumentItemSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
3
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
4
|
-
const getDocumentsSchema = buildToolSchema((t) => ({
|
|
5
|
-
projectIds: z
|
|
6
|
-
.array(z.number())
|
|
7
|
-
.describe(t('TOOL_GET_DOCUMENTS_PROJECT_ID_LIST', 'Project ID List')),
|
|
8
|
-
offset: z
|
|
9
|
-
.number()
|
|
10
|
-
.optional()
|
|
11
|
-
.default(0)
|
|
12
|
-
.describe(t('TOOL_GET_DOCUMENTS_OFFSET', 'Offset for pagination (default is 0)')),
|
|
13
|
-
}));
|
|
14
|
-
export const getDocumentsTool = (backlog, { t }) => {
|
|
15
|
-
return {
|
|
16
|
-
name: 'get_documents',
|
|
17
|
-
description: t('TOOL_GET_DOCUMENTS_DESCRIPTION', 'Gets a list of documents in a project.'),
|
|
18
|
-
schema: z.object(getDocumentsSchema(t)),
|
|
19
|
-
outputSchema: DocumentItemSchema,
|
|
20
|
-
importantFields: ['id', 'projectId', 'title', 'plain'],
|
|
21
|
-
handler: async ({ projectIds, offset }) => {
|
|
22
|
-
return backlog.getDocuments({ projectId: projectIds, offset });
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { GitRepositorySchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getGitRepositoriesSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_GIT_REPOSITORIES_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_GIT_REPOSITORIES_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
}));
|
|
15
|
-
export const getGitRepositoriesTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_git_repositories',
|
|
18
|
-
description: t('TOOL_GET_GIT_REPOSITORIES_DESCRIPTION', 'Returns list of Git repositories for a project'),
|
|
19
|
-
schema: z.object(getGitRepositoriesSchema(t)),
|
|
20
|
-
outputSchema: GitRepositorySchema,
|
|
21
|
-
handler: async ({ projectId, projectKey }) => {
|
|
22
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
23
|
-
if (!result.ok) {
|
|
24
|
-
throw result.error;
|
|
25
|
-
}
|
|
26
|
-
return backlog.getGitRepositories(result.value);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { GitRepositorySchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getGitRepositorySchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_GIT_REPOSITORY_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_GIT_REPOSITORY_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
repoId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_GIT_REPOSITORY_REPO_ID', 'Repository ID')),
|
|
18
|
-
repoName: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_GIT_REPOSITORY_REPO_NAME', 'Repository name')),
|
|
22
|
-
}));
|
|
23
|
-
export const getGitRepositoryTool = (backlog, { t }) => {
|
|
24
|
-
return {
|
|
25
|
-
name: 'get_git_repository',
|
|
26
|
-
description: t('TOOL_GET_GIT_REPOSITORY_DESCRIPTION', 'Returns information about a specific Git repository'),
|
|
27
|
-
schema: z.object(getGitRepositorySchema(t)),
|
|
28
|
-
outputSchema: GitRepositorySchema,
|
|
29
|
-
handler: async ({ projectId, projectKey, repoId, repoName }) => {
|
|
30
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
31
|
-
if (!result.ok) {
|
|
32
|
-
throw result.error;
|
|
33
|
-
}
|
|
34
|
-
const repoResult = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
|
|
35
|
-
if (!repoResult.ok) {
|
|
36
|
-
throw repoResult.error;
|
|
37
|
-
}
|
|
38
|
-
return backlog.getGitRepository(result.value, String(repoResult.value));
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
};
|
package/build/tools/getIssue.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getIssueSchema = buildToolSchema((t) => ({
|
|
6
|
-
issueId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_ISSUE_ISSUE_ID', 'The numeric ID of the issue (e.g., 12345)')),
|
|
10
|
-
issueKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_ISSUE_ISSUE_KEY', "The key of the issue (e.g., 'PROJ-123')")),
|
|
14
|
-
}));
|
|
15
|
-
export const getIssueTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_issue',
|
|
18
|
-
description: t('TOOL_GET_ISSUE_DESCRIPTION', 'Returns information about a specific issue'),
|
|
19
|
-
outputSchema: IssueSchema,
|
|
20
|
-
schema: z.object(getIssueSchema(t)),
|
|
21
|
-
handler: async ({ issueId, issueKey }) => {
|
|
22
|
-
const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
|
|
23
|
-
if (!result.ok) {
|
|
24
|
-
throw result.error;
|
|
25
|
-
}
|
|
26
|
-
return backlog.getIssue(result.value);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getIssueCommentsSchema = buildToolSchema((t) => ({
|
|
6
|
-
issueId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_ISSUE_ID', 'The numeric ID of the issue (e.g., 12345)')),
|
|
10
|
-
issueKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_ISSUE_KEY', "The key of the issue (e.g., 'PROJ-123')")),
|
|
14
|
-
minId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_MIN_ID', 'Minimum comment ID')),
|
|
18
|
-
maxId: z
|
|
19
|
-
.number()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_MAX_ID', 'Maximum comment ID')),
|
|
22
|
-
count: z
|
|
23
|
-
.number()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_COUNT', 'Number of comments to retrieve')),
|
|
26
|
-
order: z
|
|
27
|
-
.enum(['asc', 'desc'])
|
|
28
|
-
.optional()
|
|
29
|
-
.describe(t('TOOL_GET_ISSUE_COMMENTS_ORDER', 'Sort order')),
|
|
30
|
-
}));
|
|
31
|
-
export const getIssueCommentsTool = (backlog, { t }) => {
|
|
32
|
-
return {
|
|
33
|
-
name: 'get_issue_comments',
|
|
34
|
-
description: t('TOOL_GET_ISSUE_COMMENTS_DESCRIPTION', 'Returns list of comments for an issue'),
|
|
35
|
-
schema: z.object(getIssueCommentsSchema(t)),
|
|
36
|
-
outputSchema: IssueCommentSchema,
|
|
37
|
-
handler: async ({ issueId, issueKey, ...params }) => {
|
|
38
|
-
const result = resolveIdOrKey('issue', { id: issueId, key: issueKey }, t);
|
|
39
|
-
if (!result.ok) {
|
|
40
|
-
throw result.error;
|
|
41
|
-
}
|
|
42
|
-
return backlog.getIssueComments(result.value, params);
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { IssueTypeSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getIssueTypesSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_GIT_REPOSITORIES_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_GIT_REPOSITORIES_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
}));
|
|
15
|
-
export const getIssueTypesTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_issue_types',
|
|
18
|
-
description: t('TOOL_GET_ISSUE_TYPES_DESCRIPTION', 'Returns list of issue types for a project'),
|
|
19
|
-
schema: z.object(getIssueTypesSchema(t)),
|
|
20
|
-
outputSchema: IssueTypeSchema,
|
|
21
|
-
importantFields: ['id', 'name'],
|
|
22
|
-
handler: async ({ projectId, projectKey }) => {
|
|
23
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
24
|
-
if (!result.ok) {
|
|
25
|
-
throw result.error;
|
|
26
|
-
}
|
|
27
|
-
return backlog.getIssueTypes(result.value);
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
};
|
package/build/tools/getIssues.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { customFieldFiltersToPayload } from '../backlog/customFields.js';
|
|
5
|
-
import { buildCustomFieldFilterSchema } from './shared/customFieldFiltersSchema.js';
|
|
6
|
-
const getIssuesSchema = buildToolSchema((t) => ({
|
|
7
|
-
projectId: z
|
|
8
|
-
.array(z.number())
|
|
9
|
-
.optional()
|
|
10
|
-
.describe(t('TOOL_GET_ISSUES_PROJECT_ID', 'Project IDs')),
|
|
11
|
-
issueTypeId: z
|
|
12
|
-
.array(z.number())
|
|
13
|
-
.optional()
|
|
14
|
-
.describe(t('TOOL_GET_ISSUES_ISSUE_TYPE_ID', 'Issue type IDs')),
|
|
15
|
-
categoryId: z
|
|
16
|
-
.array(z.number())
|
|
17
|
-
.optional()
|
|
18
|
-
.describe(t('TOOL_GET_ISSUES_CATEGORY_ID', 'Category IDs')),
|
|
19
|
-
versionId: z
|
|
20
|
-
.array(z.number())
|
|
21
|
-
.optional()
|
|
22
|
-
.describe(t('TOOL_GET_ISSUES_VERSION_ID', 'Version IDs')),
|
|
23
|
-
milestoneId: z
|
|
24
|
-
.array(z.number())
|
|
25
|
-
.optional()
|
|
26
|
-
.describe(t('TOOL_GET_ISSUES_MILESTONE_ID', 'Milestone IDs')),
|
|
27
|
-
statusId: z
|
|
28
|
-
.array(z.number())
|
|
29
|
-
.optional()
|
|
30
|
-
.describe(t('TOOL_GET_ISSUES_STATUS_ID', 'Status IDs')),
|
|
31
|
-
priorityId: z
|
|
32
|
-
.array(z.number())
|
|
33
|
-
.optional()
|
|
34
|
-
.describe(t('TOOL_GET_ISSUES_PRIORITY_ID', 'Priority IDs')),
|
|
35
|
-
assigneeId: z
|
|
36
|
-
.array(z.number())
|
|
37
|
-
.optional()
|
|
38
|
-
.describe(t('TOOL_GET_ISSUES_ASSIGNEE_ID', 'Assignee user IDs')),
|
|
39
|
-
createdUserId: z
|
|
40
|
-
.array(z.number())
|
|
41
|
-
.optional()
|
|
42
|
-
.describe(t('TOOL_GET_ISSUES_CREATED_USER_ID', 'Created user IDs')),
|
|
43
|
-
resolutionId: z
|
|
44
|
-
.array(z.number())
|
|
45
|
-
.optional()
|
|
46
|
-
.describe(t('TOOL_GET_ISSUES_RESOLUTION_ID', 'Resolution IDs')),
|
|
47
|
-
parentIssueId: z
|
|
48
|
-
.array(z.number())
|
|
49
|
-
.optional()
|
|
50
|
-
.describe(t('TOOL_GET_ISSUES_PARENT_ISSUE_ID', 'Parent issue IDs')),
|
|
51
|
-
keyword: z
|
|
52
|
-
.string()
|
|
53
|
-
.optional()
|
|
54
|
-
.describe(t('TOOL_GET_ISSUES_KEYWORD', 'Keyword to search for in issues')),
|
|
55
|
-
startDateSince: z
|
|
56
|
-
.string()
|
|
57
|
-
.optional()
|
|
58
|
-
.describe(t('TOOL_GET_ISSUES_START_DATE_SINCE', 'Start date since (yyyy-MM-dd)')),
|
|
59
|
-
startDateUntil: z
|
|
60
|
-
.string()
|
|
61
|
-
.optional()
|
|
62
|
-
.describe(t('TOOL_GET_ISSUES_START_DATE_UNTIL', 'Start date until (yyyy-MM-dd)')),
|
|
63
|
-
dueDateSince: z
|
|
64
|
-
.string()
|
|
65
|
-
.optional()
|
|
66
|
-
.describe(t('TOOL_GET_ISSUES_DUE_DATE_SINCE', 'Due date since (yyyy-MM-dd)')),
|
|
67
|
-
dueDateUntil: z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe(t('TOOL_GET_ISSUES_DUE_DATE_UNTIL', 'Due date until (yyyy-MM-dd)')),
|
|
71
|
-
createdSince: z
|
|
72
|
-
.string()
|
|
73
|
-
.optional()
|
|
74
|
-
.describe(t('TOOL_GET_ISSUES_CREATED_SINCE', 'Created since (yyyy-MM-dd)')),
|
|
75
|
-
createdUntil: z
|
|
76
|
-
.string()
|
|
77
|
-
.optional()
|
|
78
|
-
.describe(t('TOOL_GET_ISSUES_CREATED_UNTIL', 'Created until (yyyy-MM-dd)')),
|
|
79
|
-
updatedSince: z
|
|
80
|
-
.string()
|
|
81
|
-
.optional()
|
|
82
|
-
.describe(t('TOOL_GET_ISSUES_UPDATED_SINCE', 'Updated since (yyyy-MM-dd)')),
|
|
83
|
-
updatedUntil: z
|
|
84
|
-
.string()
|
|
85
|
-
.optional()
|
|
86
|
-
.describe(t('TOOL_GET_ISSUES_UPDATED_UNTIL', 'Updated until (yyyy-MM-dd)')),
|
|
87
|
-
sort: z
|
|
88
|
-
.enum([
|
|
89
|
-
'issueType',
|
|
90
|
-
'category',
|
|
91
|
-
'version',
|
|
92
|
-
'milestone',
|
|
93
|
-
'summary',
|
|
94
|
-
'status',
|
|
95
|
-
'priority',
|
|
96
|
-
'attachment',
|
|
97
|
-
'sharedFile',
|
|
98
|
-
'created',
|
|
99
|
-
'createdUser',
|
|
100
|
-
'updated',
|
|
101
|
-
'updatedUser',
|
|
102
|
-
'assignee',
|
|
103
|
-
'startDate',
|
|
104
|
-
'dueDate',
|
|
105
|
-
'estimatedHours',
|
|
106
|
-
'actualHours',
|
|
107
|
-
'childIssue',
|
|
108
|
-
])
|
|
109
|
-
.optional()
|
|
110
|
-
.describe(t('TOOL_GET_ISSUES_SORT', 'Sort field')),
|
|
111
|
-
order: z
|
|
112
|
-
.enum(['asc', 'desc'])
|
|
113
|
-
.optional()
|
|
114
|
-
.describe(t('TOOL_GET_ISSUES_ORDER', 'Sort order')),
|
|
115
|
-
offset: z
|
|
116
|
-
.number()
|
|
117
|
-
.optional()
|
|
118
|
-
.describe(t('TOOL_GET_ISSUES_OFFSET', 'Offset for pagination')),
|
|
119
|
-
count: z
|
|
120
|
-
.number()
|
|
121
|
-
.optional()
|
|
122
|
-
.describe(t('TOOL_GET_ISSUES_COUNT', 'Number of issues to retrieve')),
|
|
123
|
-
customFields: z
|
|
124
|
-
.array(buildCustomFieldFilterSchema(t))
|
|
125
|
-
.optional()
|
|
126
|
-
.describe(t('TOOL_GET_ISSUES_CUSTOM_FIELDS', 'Custom field filters (text, numeric, date, or list)')),
|
|
127
|
-
}));
|
|
128
|
-
export const getIssuesTool = (backlog, { t }) => {
|
|
129
|
-
return {
|
|
130
|
-
name: 'get_issues',
|
|
131
|
-
description: t('TOOL_GET_ISSUES_DESCRIPTION', 'Returns list of issues'),
|
|
132
|
-
schema: z.object(getIssuesSchema(t)),
|
|
133
|
-
importantFields: [
|
|
134
|
-
'projectId',
|
|
135
|
-
'issueKey',
|
|
136
|
-
'keyId',
|
|
137
|
-
'summary',
|
|
138
|
-
'description',
|
|
139
|
-
'issueType',
|
|
140
|
-
],
|
|
141
|
-
outputSchema: IssueSchema,
|
|
142
|
-
handler: async ({ customFields, ...rest }) => {
|
|
143
|
-
return backlog.getIssues({
|
|
144
|
-
...rest,
|
|
145
|
-
...customFieldFiltersToPayload(customFields),
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
};
|
package/build/tools/getMyself.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { UserSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getMyselfSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const getMyselfTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'get_myself',
|
|
8
|
-
description: t('TOOL_GET_MYSELF_DESCRIPTION', 'Returns information about the authenticated user'),
|
|
9
|
-
schema: z.object(getMyselfSchema(t)),
|
|
10
|
-
outputSchema: UserSchema,
|
|
11
|
-
importantFields: ['id', 'userId', 'name', 'roleType'],
|
|
12
|
-
handler: async () => backlog.getMyself(),
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { NotificationSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getNotificationsSchema = buildToolSchema((t) => ({
|
|
5
|
-
minId: z
|
|
6
|
-
.number()
|
|
7
|
-
.optional()
|
|
8
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_MIN_ID', 'Minimum notification ID')),
|
|
9
|
-
maxId: z
|
|
10
|
-
.number()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_MAX_ID', 'Maximum notification ID')),
|
|
13
|
-
count: z
|
|
14
|
-
.number()
|
|
15
|
-
.optional()
|
|
16
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_COUNT', 'Number of notifications to retrieve')),
|
|
17
|
-
order: z
|
|
18
|
-
.enum(['asc', 'desc'])
|
|
19
|
-
.optional()
|
|
20
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_ORDER', 'Sort order')),
|
|
21
|
-
}));
|
|
22
|
-
export const getNotificationsTool = (backlog, { t }) => {
|
|
23
|
-
return {
|
|
24
|
-
name: 'get_notifications',
|
|
25
|
-
description: t('TOOL_GET_NOTIFICATIONS_DESCRIPTION', 'Returns list of notifications'),
|
|
26
|
-
schema: z.object(getNotificationsSchema(t)),
|
|
27
|
-
outputSchema: NotificationSchema,
|
|
28
|
-
handler: async ({ minId, maxId, count, order }) => backlog.getNotifications({
|
|
29
|
-
minId,
|
|
30
|
-
maxId,
|
|
31
|
-
count,
|
|
32
|
-
order,
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { NotificationCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getNotificationsCountSchema = buildToolSchema((t) => ({
|
|
5
|
-
alreadyRead: z
|
|
6
|
-
.boolean()
|
|
7
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_COUNT_ALREADY_READ', 'Whether to include already read notifications')),
|
|
8
|
-
resourceAlreadyRead: z
|
|
9
|
-
.boolean()
|
|
10
|
-
.describe(t('TOOL_GET_NOTIFICATIONS_COUNT_RESOURCE_ALREADY_READ', 'Whether to include notifications for already read resources')),
|
|
11
|
-
}));
|
|
12
|
-
export const getNotificationsCountTool = (backlog, { t }) => {
|
|
13
|
-
return {
|
|
14
|
-
name: 'count_notifications',
|
|
15
|
-
description: t('TOOL_COUNT_NOTIFICATIONS_DESCRIPTION', 'Returns count of notifications'),
|
|
16
|
-
schema: z.object(getNotificationsCountSchema(t)),
|
|
17
|
-
outputSchema: NotificationCountSchema,
|
|
18
|
-
handler: async (params) => backlog.getNotificationsCount(params),
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { PrioritySchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getPrioritiesSchema = buildToolSchema((_t) => ({}));
|
|
5
|
-
export const getPrioritiesTool = (backlog, { t }) => {
|
|
6
|
-
return {
|
|
7
|
-
name: 'get_priorities',
|
|
8
|
-
description: t('TOOL_GET_PRIORITIES_DESCRIPTION', 'Returns list of priorities'),
|
|
9
|
-
schema: z.object(getPrioritiesSchema(t)),
|
|
10
|
-
outputSchema: PrioritySchema,
|
|
11
|
-
handler: async () => backlog.getPriorities(),
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getProjectSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_PROJECT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_PROJECT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
}));
|
|
15
|
-
export const getProjectTool = (backlog, { t }) => {
|
|
16
|
-
return {
|
|
17
|
-
name: 'get_project',
|
|
18
|
-
description: t('TOOL_GET_PROJECT_DESCRIPTION', 'Returns information about a specific project'),
|
|
19
|
-
schema: z.object(getProjectSchema(t)),
|
|
20
|
-
outputSchema: ProjectSchema,
|
|
21
|
-
handler: async ({ projectId, projectKey }) => {
|
|
22
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
23
|
-
if (!result.ok) {
|
|
24
|
-
throw result.error;
|
|
25
|
-
}
|
|
26
|
-
return backlog.getProject(result.value);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
const getProjectListSchema = buildToolSchema((t) => ({
|
|
5
|
-
archived: z
|
|
6
|
-
.boolean()
|
|
7
|
-
.optional()
|
|
8
|
-
.describe(t('TOOL_GET_PROJECT_LIST_ARCHIVED', 'For unspecified parameters, this form returns all projects. For ‘false’ parameters, it returns unarchived projects. For ‘true’ parameters, it returns archived projects.')),
|
|
9
|
-
all: z
|
|
10
|
-
.boolean()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe(t('TOOL_GET_PROJECT_LIST_ALL', 'Only applies to administrators. If ‘true,’ it returns all projects. If ‘false,’ it returns only projects they have joined.')),
|
|
13
|
-
}));
|
|
14
|
-
export const getProjectListTool = (backlog, { t }) => {
|
|
15
|
-
return {
|
|
16
|
-
name: 'get_project_list',
|
|
17
|
-
description: t('TOOL_GET_PROJECT_LIST_DESCRIPTION', 'Returns list of projects'),
|
|
18
|
-
schema: z.object(getProjectListSchema(t)),
|
|
19
|
-
outputSchema: ProjectSchema,
|
|
20
|
-
importantFields: ['id', 'projectKey', 'name'],
|
|
21
|
-
handler: async ({ archived, all }) => backlog.getProjects({ archived, all }),
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getPullRequestSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_PULL_REQUEST_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_PULL_REQUEST_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
repoId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_PULL_REQUEST_REPO_ID', 'Repository ID')),
|
|
18
|
-
repoName: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_PULL_REQUEST_REPO_NAME', 'Repository name')),
|
|
22
|
-
number: z
|
|
23
|
-
.number()
|
|
24
|
-
.describe(t('TOOL_GET_PULL_REQUEST_NUMBER', 'Pull request number')),
|
|
25
|
-
}));
|
|
26
|
-
export const getPullRequestTool = (backlog, { t }) => {
|
|
27
|
-
return {
|
|
28
|
-
name: 'get_pull_request',
|
|
29
|
-
description: t('TOOL_GET_PULL_REQUEST_DESCRIPTION', 'Returns information about a specific pull request'),
|
|
30
|
-
schema: z.object(getPullRequestSchema(t)),
|
|
31
|
-
outputSchema: PullRequestSchema,
|
|
32
|
-
handler: async ({ projectId, projectKey, repoId, repoName, number }) => {
|
|
33
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
34
|
-
if (!result.ok) {
|
|
35
|
-
throw result.error;
|
|
36
|
-
}
|
|
37
|
-
const repoRes = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
|
|
38
|
-
if (!repoRes.ok) {
|
|
39
|
-
throw repoRes.error;
|
|
40
|
-
}
|
|
41
|
-
return backlog.getPullRequest(result.value, String(repoRes.value), number);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getPullRequestCommentsSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_PROJECT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_PROJECT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
repoId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_REPO_ID_OR_NAME', 'Repository ID')),
|
|
18
|
-
repoName: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_REPO_ID_OR_NAME', 'Repository name')),
|
|
22
|
-
number: z
|
|
23
|
-
.number()
|
|
24
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_NUMBER', 'Pull request number')),
|
|
25
|
-
minId: z
|
|
26
|
-
.number()
|
|
27
|
-
.optional()
|
|
28
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_MIN_ID', 'Minimum comment ID')),
|
|
29
|
-
maxId: z
|
|
30
|
-
.number()
|
|
31
|
-
.optional()
|
|
32
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_MAX_ID', 'Maximum comment ID')),
|
|
33
|
-
count: z
|
|
34
|
-
.number()
|
|
35
|
-
.optional()
|
|
36
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_COUNT', 'Number of comments to retrieve')),
|
|
37
|
-
order: z
|
|
38
|
-
.enum(['asc', 'desc'])
|
|
39
|
-
.optional()
|
|
40
|
-
.describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_ORDER', 'Sort order')),
|
|
41
|
-
}));
|
|
42
|
-
export const getPullRequestCommentsTool = (backlog, { t }) => {
|
|
43
|
-
return {
|
|
44
|
-
name: 'get_pull_request_comments',
|
|
45
|
-
description: t('TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION', 'Returns list of comments for a pull request'),
|
|
46
|
-
schema: z.object(getPullRequestCommentsSchema(t)),
|
|
47
|
-
outputSchema: PullRequestCommentSchema,
|
|
48
|
-
handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => {
|
|
49
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
50
|
-
if (!result.ok) {
|
|
51
|
-
throw result.error;
|
|
52
|
-
}
|
|
53
|
-
const repoResult = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
|
|
54
|
-
if (!repoResult.ok) {
|
|
55
|
-
throw repoResult.error;
|
|
56
|
-
}
|
|
57
|
-
return backlog.getPullRequestComments(result.value, String(repoResult.value), number, params);
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
-
import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
-
import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';
|
|
5
|
-
const getPullRequestsSchema = buildToolSchema((t) => ({
|
|
6
|
-
projectId: z
|
|
7
|
-
.number()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
|
|
10
|
-
projectKey: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
|
|
14
|
-
repoId: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_REPO_ID', 'Repository ID')),
|
|
18
|
-
repoName: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_REPO_NAME', 'Repository name')),
|
|
22
|
-
statusId: z
|
|
23
|
-
.array(z.number())
|
|
24
|
-
.optional()
|
|
25
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_STATUS_ID', 'Status IDs')),
|
|
26
|
-
assigneeId: z
|
|
27
|
-
.array(z.number())
|
|
28
|
-
.optional()
|
|
29
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_ASSIGNEE_ID', 'Assignee user IDs')),
|
|
30
|
-
issueId: z
|
|
31
|
-
.array(z.number())
|
|
32
|
-
.optional()
|
|
33
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_ISSUE_ID', 'Issue IDs')),
|
|
34
|
-
createdUserId: z
|
|
35
|
-
.array(z.number())
|
|
36
|
-
.optional()
|
|
37
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_CREATED_USER_ID', 'Created user IDs')),
|
|
38
|
-
offset: z
|
|
39
|
-
.number()
|
|
40
|
-
.optional()
|
|
41
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_OFFSET', 'Offset for pagination')),
|
|
42
|
-
count: z
|
|
43
|
-
.number()
|
|
44
|
-
.optional()
|
|
45
|
-
.describe(t('TOOL_GET_PULL_REQUESTS_COUNT', 'Number of pull requests to retrieve')),
|
|
46
|
-
}));
|
|
47
|
-
export const getPullRequestsTool = (backlog, { t }) => {
|
|
48
|
-
return {
|
|
49
|
-
name: 'get_pull_requests',
|
|
50
|
-
description: t('TOOL_GET_PULL_REQUESTS_DESCRIPTION', 'Returns list of pull requests for a repository'),
|
|
51
|
-
schema: z.object(getPullRequestsSchema(t)),
|
|
52
|
-
outputSchema: PullRequestSchema,
|
|
53
|
-
handler: async ({ projectId, projectKey, repoId, repoName, ...params }) => {
|
|
54
|
-
const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
|
|
55
|
-
if (!result.ok) {
|
|
56
|
-
throw result.error;
|
|
57
|
-
}
|
|
58
|
-
const repoResult = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
|
|
59
|
-
if (!repoResult.ok) {
|
|
60
|
-
throw repoResult.error;
|
|
61
|
-
}
|
|
62
|
-
return backlog.getPullRequests(result.value, String(repoResult.value), params);
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
};
|