backlog-mcp-server 0.6.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.
Files changed (85) hide show
  1. package/README.ja.md +89 -41
  2. package/README.md +102 -43
  3. package/package.json +16 -12
  4. package/build/backlog/backlogErrorHandler.js +0 -8
  5. package/build/backlog/customFields.js +0 -70
  6. package/build/backlog/parseBacklogAPIError.js +0 -38
  7. package/build/createTranslationHelper.js +0 -28
  8. package/build/handlers/builders/composeToolHandler.js +0 -26
  9. package/build/handlers/transformers/wrapWithErrorHandling.js +0 -4
  10. package/build/handlers/transformers/wrapWithFieldPicking.js +0 -55
  11. package/build/handlers/transformers/wrapWithTokenLimit.js +0 -21
  12. package/build/handlers/transformers/wrapWithToolResult.js +0 -39
  13. package/build/index.js +0 -100
  14. package/build/registerTools.js +0 -37
  15. package/build/tools/addIssue.js +0 -97
  16. package/build/tools/addIssueComment.js +0 -44
  17. package/build/tools/addProject.js +0 -39
  18. package/build/tools/addPullRequest.js +0 -65
  19. package/build/tools/addPullRequestComment.js +0 -52
  20. package/build/tools/addVersionMilestone.js +0 -51
  21. package/build/tools/addWatching.js +0 -25
  22. package/build/tools/addWiki.js +0 -29
  23. package/build/tools/countIssues.js +0 -105
  24. package/build/tools/deleteIssue.js +0 -29
  25. package/build/tools/deleteProject.js +0 -29
  26. package/build/tools/deleteVersion.js +0 -35
  27. package/build/tools/deleteWatching.js +0 -17
  28. package/build/tools/dynamicTools/toolsets.js +0 -103
  29. package/build/tools/getCategories.js +0 -30
  30. package/build/tools/getCustomFields.js +0 -37
  31. package/build/tools/getDocument.js +0 -20
  32. package/build/tools/getDocumentTree.js +0 -20
  33. package/build/tools/getDocuments.js +0 -25
  34. package/build/tools/getGitRepositories.js +0 -29
  35. package/build/tools/getGitRepository.js +0 -41
  36. package/build/tools/getIssue.js +0 -29
  37. package/build/tools/getIssueComments.js +0 -45
  38. package/build/tools/getIssueTypes.js +0 -30
  39. package/build/tools/getIssues.js +0 -149
  40. package/build/tools/getMyself.js +0 -14
  41. package/build/tools/getNotifications.js +0 -35
  42. package/build/tools/getNotificationsCount.js +0 -20
  43. package/build/tools/getPriorities.js +0 -13
  44. package/build/tools/getProject.js +0 -29
  45. package/build/tools/getProjectList.js +0 -23
  46. package/build/tools/getPullRequest.js +0 -44
  47. package/build/tools/getPullRequestComments.js +0 -60
  48. package/build/tools/getPullRequests.js +0 -65
  49. package/build/tools/getPullRequestsCount.js +0 -57
  50. package/build/tools/getResolutions.js +0 -13
  51. package/build/tools/getSpace.js +0 -14
  52. package/build/tools/getUsers.js +0 -14
  53. package/build/tools/getVersionMilestoneList.js +0 -37
  54. package/build/tools/getWatchingListCount.js +0 -17
  55. package/build/tools/getWatchingListItems.js +0 -17
  56. package/build/tools/getWiki.js +0 -21
  57. package/build/tools/getWikiPages.js +0 -37
  58. package/build/tools/getWikisCount.js +0 -29
  59. package/build/tools/markNotificationAsRead.js +0 -26
  60. package/build/tools/markWatchingAsRead.js +0 -26
  61. package/build/tools/resetUnreadNotificationCount.js +0 -13
  62. package/build/tools/shared/customFieldFiltersSchema.js +0 -78
  63. package/build/tools/tools.js +0 -161
  64. package/build/tools/updateIssue.js +0 -119
  65. package/build/tools/updateProject.js +0 -57
  66. package/build/tools/updatePullRequest.js +0 -68
  67. package/build/tools/updatePullRequestComment.js +0 -51
  68. package/build/tools/updateVersionMilestone.js +0 -57
  69. package/build/tools/updateWatching.js +0 -18
  70. package/build/tools/updateWiki.js +0 -37
  71. package/build/types/mcp.js +0 -1
  72. package/build/types/result.js +0 -3
  73. package/build/types/tool.js +0 -1
  74. package/build/types/toolsets.js +0 -1
  75. package/build/types/zod/backlogOutputDefinition.js +0 -468
  76. package/build/utils/generateFieldsDescription.js +0 -47
  77. package/build/utils/logger.js +0 -20
  78. package/build/utils/resolveIdOrKey.js +0 -25
  79. package/build/utils/runToolSafely.js +0 -18
  80. package/build/utils/tokenCounter.js +0 -11
  81. package/build/utils/toolRegistrar.js +0 -12
  82. package/build/utils/toolsetUtils.js +0 -48
  83. package/build/utils/wrapServerWithToolRegistry.js +0 -16
  84. package/build/version.js +0 -1
  85. package/build/version.template.js +0 -1
@@ -1,57 +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 updateProjectSchema = buildToolSchema((t) => ({
6
- projectId: z
7
- .number()
8
- .optional()
9
- .describe(t('TOOL_UPDATE_PROJECT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
10
- projectKey: z
11
- .string()
12
- .optional()
13
- .describe(t('TOOL_UPDATE_PROJECT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
14
- name: z
15
- .string()
16
- .optional()
17
- .describe(t('TOOL_UPDATE_PROJECT_NAME', 'Project name')),
18
- key: z
19
- .string()
20
- .optional()
21
- .describe(t('TOOL_UPDATE_PROJECT_KEY', 'Project key')),
22
- chartEnabled: z
23
- .boolean()
24
- .optional()
25
- .describe(t('TOOL_UPDATE_PROJECT_CHART_ENABLED', 'Whether to enable chart')),
26
- subtaskingEnabled: z
27
- .boolean()
28
- .optional()
29
- .describe(t('TOOL_UPDATE_PROJECT_SUBTASKING_ENABLED', 'Whether to enable subtasking')),
30
- projectLeaderCanEditProjectLeader: z
31
- .boolean()
32
- .optional()
33
- .describe(t('TOOL_UPDATE_PROJECT_LEADER_CAN_EDIT', 'Whether project leaders can edit other project leaders')),
34
- textFormattingRule: z
35
- .enum(['backlog', 'markdown'])
36
- .optional()
37
- .describe(t('TOOL_UPDATE_PROJECT_TEXT_FORMATTING', 'Text formatting rule')),
38
- archived: z
39
- .boolean()
40
- .optional()
41
- .describe(t('TOOL_UPDATE_PROJECT_ARCHIVED', 'Whether to archive the project')),
42
- }));
43
- export const updateProjectTool = (backlog, { t }) => {
44
- return {
45
- name: 'update_project',
46
- description: t('TOOL_UPDATE_PROJECT_DESCRIPTION', 'Updates an existing project'),
47
- schema: z.object(updateProjectSchema(t)),
48
- outputSchema: ProjectSchema,
49
- handler: async ({ projectId, projectKey, ...param }) => {
50
- const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
51
- if (!result.ok) {
52
- throw result.error;
53
- }
54
- return backlog.patchProject(result.value, param);
55
- },
56
- };
57
- };
@@ -1,68 +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 } from '../utils/resolveIdOrKey.js';
5
- const updatePullRequestSchema = buildToolSchema((t) => ({
6
- projectId: z
7
- .number()
8
- .optional()
9
- .describe(t('TOOL_UPDATE_PULL_REQUEST_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
10
- projectKey: z
11
- .string()
12
- .optional()
13
- .describe(t('TOOL_UPDATE_PULL_REQUEST_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
14
- repoId: z
15
- .number()
16
- .optional()
17
- .describe(t('TOOL_UPDATE_PULL_REQUEST_REPO_ID', 'Repository ID')),
18
- repoName: z
19
- .string()
20
- .optional()
21
- .describe(t('TOOL_UPDATE_PULL_REQUEST_REPO_NAME', 'Repository name')),
22
- number: z
23
- .number()
24
- .describe(t('TOOL_UPDATE_PULL_REQUEST_NUMBER', 'Pull request number')),
25
- summary: z
26
- .string()
27
- .optional()
28
- .describe(t('TOOL_UPDATE_PULL_REQUEST_SUMMARY', 'Summary of the pull request')),
29
- description: z
30
- .string()
31
- .optional()
32
- .describe(t('TOOL_UPDATE_PULL_REQUEST_DESCRIPTION', 'Description of the pull request')),
33
- issueId: z
34
- .number()
35
- .optional()
36
- .describe(t('TOOL_UPDATE_PULL_REQUEST_ISSUE_ID', 'Issue ID to link')),
37
- assigneeId: z
38
- .number()
39
- .optional()
40
- .describe(t('TOOL_UPDATE_PULL_REQUEST_ASSIGNEE_ID', 'User ID of the assignee')),
41
- notifiedUserId: z
42
- .array(z.number())
43
- .optional()
44
- .describe(t('TOOL_UPDATE_PULL_REQUEST_NOTIFIED_USER_ID', 'User IDs to notify')),
45
- statusId: z
46
- .number()
47
- .optional()
48
- .describe(t('TOOL_UPDATE_PULL_REQUEST_STATUS_ID', 'Status ID')),
49
- }));
50
- export const updatePullRequestTool = (backlog, { t }) => {
51
- return {
52
- name: 'update_pull_request',
53
- description: t('TOOL_UPDATE_PULL_REQUEST_DESCRIPTION', 'Updates an existing pull request'),
54
- schema: z.object(updatePullRequestSchema(t)),
55
- outputSchema: PullRequestSchema,
56
- handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => {
57
- const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
58
- if (!result.ok) {
59
- throw result.error;
60
- }
61
- const resultRepo = resolveIdOrKey('repository', { id: repoId, key: repoName }, t);
62
- if (!resultRepo.ok) {
63
- throw resultRepo.error;
64
- }
65
- return backlog.patchPullRequest(result.value, String(resultRepo.value), number, params);
66
- },
67
- };
68
- };
@@ -1,51 +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 updatePullRequestCommentSchema = buildToolSchema((t) => ({
6
- projectId: z
7
- .number()
8
- .optional()
9
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
10
- projectKey: z
11
- .string()
12
- .optional()
13
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
14
- repoId: z
15
- .number()
16
- .optional()
17
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_REPO_ID', 'Repository ID')),
18
- repoName: z
19
- .string()
20
- .optional()
21
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_REPO_NAME', 'Repository name')),
22
- number: z
23
- .number()
24
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_NUMBER', 'Pull request number')),
25
- commentId: z
26
- .number()
27
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_COMMENT_ID', 'Comment ID')),
28
- content: z
29
- .string()
30
- .describe(t('TOOL_UPDATE_PULL_REQUEST_COMMENT_CONTENT', 'Comment content')),
31
- }));
32
- export const updatePullRequestCommentTool = (backlog, { t }) => {
33
- return {
34
- name: 'update_pull_request_comment',
35
- description: t('TOOL_UPDATE_PULL_REQUEST_COMMENT_DESCRIPTION', 'Updates a comment on a pull request'),
36
- schema: z.object(updatePullRequestCommentSchema(t)),
37
- outputSchema: PullRequestCommentSchema,
38
- importantFields: ['id', 'content', 'createdUser', 'updated'],
39
- handler: async ({ projectId, projectKey, repoId, repoName, number, commentId, content, }) => {
40
- const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
41
- if (!result.ok) {
42
- throw result.error;
43
- }
44
- const repoResult = resolveIdOrName('repository', { id: repoId, name: repoName }, t);
45
- if (!repoResult.ok) {
46
- throw repoResult.error;
47
- }
48
- return backlog.patchPullRequestComments(result.value, String(repoResult.value), number, commentId, { content });
49
- },
50
- };
51
- };
@@ -1,57 +0,0 @@
1
- import { z } from 'zod';
2
- import { buildToolSchema } from '../types/tool.js';
3
- import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
4
- import { resolveIdOrKey } from '../utils/resolveIdOrKey.js';
5
- const updateVersionMilestoneSchema = buildToolSchema((t) => ({
6
- projectId: z
7
- .number()
8
- .optional()
9
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)')),
10
- projectKey: z
11
- .string()
12
- .optional()
13
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')")),
14
- id: z.number().describe(t('TOOL_UPDATE_VERSION_MILESTONE_ID', 'Version ID')),
15
- name: z
16
- .string()
17
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_NAME', 'Version name')),
18
- description: z
19
- .string()
20
- .optional()
21
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_DESCRIPTION', 'Version description')),
22
- startDate: z
23
- .string()
24
- .optional()
25
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_START_DATE', 'Start date')),
26
- releaseDueDate: z
27
- .string()
28
- .optional()
29
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_RELEASE_DUE_DATE', 'Release due date')),
30
- archived: z
31
- .boolean()
32
- .optional()
33
- .describe(t('TOOL_UPDATE_VERSION_MILESTONE_ARCHIVED', 'Archive status of the version')),
34
- }));
35
- export const updateVersionMilestoneTool = (backlog, { t }) => {
36
- return {
37
- name: 'update_version_milestone',
38
- description: t('TOOL_UPDATE_VERSION_MILESTONE_DESCRIPTION', 'Updates an existing version milestone'),
39
- schema: z.object(updateVersionMilestoneSchema(t)),
40
- outputSchema: VersionSchema,
41
- importantFields: [
42
- 'id',
43
- 'name',
44
- 'description',
45
- 'startDate',
46
- 'releaseDueDate',
47
- 'archived',
48
- ],
49
- handler: async ({ projectId, projectKey, id, ...params }) => {
50
- const result = resolveIdOrKey('project', { id: projectId, key: projectKey }, t);
51
- if (!result.ok) {
52
- throw result.error;
53
- }
54
- return backlog.patchVersions(result.value, id, params);
55
- },
56
- };
57
- };
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import { buildToolSchema } from '../types/tool.js';
3
- import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
4
- const updateWatchingSchema = buildToolSchema((t) => ({
5
- watchId: z.number().describe(t('TOOL_UPDATE_WATCHING_WATCH_ID', 'Watch ID')),
6
- note: z
7
- .string()
8
- .describe(t('TOOL_UPDATE_WATCHING_NOTE', 'Updated note for the watch')),
9
- }));
10
- export const updateWatchingTool = (backlog, { t }) => {
11
- return {
12
- name: 'update_watching',
13
- description: t('TOOL_UPDATE_WATCHING_DESCRIPTION', 'Updates an existing watch note'),
14
- schema: z.object(updateWatchingSchema(t)),
15
- outputSchema: WatchingListItemSchema,
16
- handler: async ({ watchId, note }) => backlog.patchWatchingListItem(watchId, note),
17
- };
18
- };
@@ -1,37 +0,0 @@
1
- import { z } from 'zod';
2
- import { buildToolSchema } from '../types/tool.js';
3
- import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
4
- const updateWikiSchema = buildToolSchema((t) => ({
5
- wikiId: z
6
- .union([z.string(), z.number()])
7
- .describe(t('TOOL_UPDATE_WIKI_ID', 'Wiki ID')),
8
- name: z
9
- .string()
10
- .optional()
11
- .describe(t('TOOL_UPDATE_WIKI_NAME', 'Name of the wiki page')),
12
- content: z
13
- .string()
14
- .optional()
15
- .describe(t('TOOL_UPDATE_WIKI_CONTENT', 'Content of the wiki page')),
16
- mailNotify: z
17
- .boolean()
18
- .optional()
19
- .describe(t('TOOL_UPDATE_WIKI_MAIL_NOTIFY', 'Whether to send notification emails (default: false)')),
20
- }));
21
- export const updateWikiTool = (backlog, { t }) => {
22
- return {
23
- name: 'update_wiki',
24
- description: t('TOOL_UPDATE_WIKI_DESCRIPTION', 'Updates an existing wiki page'),
25
- schema: z.object(updateWikiSchema(t)),
26
- outputSchema: WikiSchema,
27
- importantFields: ['id', 'name', 'content', 'updatedUser'],
28
- handler: async ({ wikiId, name, content, mailNotify }) => {
29
- const wikiIdNumber = typeof wikiId === 'string' ? parseInt(wikiId, 10) : wikiId;
30
- return backlog.patchWiki(wikiIdNumber, {
31
- name,
32
- content,
33
- mailNotify,
34
- });
35
- },
36
- };
37
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export function isErrorLike(res) {
2
- return res.kind === 'error';
3
- }
@@ -1 +0,0 @@
1
- export const buildToolSchema = (fn) => fn;
@@ -1 +0,0 @@
1
- export {};