bamboo-mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +366 -0
- package/dist/bamboo-client.d.ts +71 -0
- package/dist/bamboo-client.js +363 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +44 -0
- package/dist/tools/branches.d.ts +3 -0
- package/dist/tools/branches.js +65 -0
- package/dist/tools/builds.d.ts +3 -0
- package/dist/tools/builds.js +221 -0
- package/dist/tools/deployments.d.ts +3 -0
- package/dist/tools/deployments.js +147 -0
- package/dist/tools/plans.d.ts +3 -0
- package/dist/tools/plans.js +152 -0
- package/dist/tools/projects.d.ts +3 -0
- package/dist/tools/projects.js +64 -0
- package/dist/tools/queue.d.ts +3 -0
- package/dist/tools/queue.js +55 -0
- package/dist/tools/server.d.ts +3 -0
- package/dist/tools/server.js +52 -0
- package/dist/types.d.ts +238 -0
- package/dist/types.js +2 -0
- package/package.json +52 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerBuildTools(server, client) {
|
|
3
|
+
// Trigger build
|
|
4
|
+
server.tool('bamboo_trigger_build', 'Trigger a build for a Bamboo plan', {
|
|
5
|
+
plan_key: z.string().describe('The plan key to build (e.g., "PROJ-PLAN")'),
|
|
6
|
+
stage: z.string().optional().describe('Specific stage to execute'),
|
|
7
|
+
execute_all_stages: z.boolean().optional().describe('Execute all stages (default: true)'),
|
|
8
|
+
custom_revision: z.string().optional().describe('Custom VCS revision to build'),
|
|
9
|
+
variables: z.record(z.string()).optional().describe('Bamboo variables to pass to the build (key-value pairs)'),
|
|
10
|
+
}, async ({ plan_key, stage, execute_all_stages, custom_revision, variables }) => {
|
|
11
|
+
try {
|
|
12
|
+
const result = await client.triggerBuild(plan_key, {
|
|
13
|
+
stage,
|
|
14
|
+
executeAllStages: execute_all_stages,
|
|
15
|
+
customRevision: custom_revision,
|
|
16
|
+
variables,
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: JSON.stringify(result, null, 2),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
isError: true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// Stop build
|
|
40
|
+
server.tool('bamboo_stop_build', 'Stop a running build for a Bamboo plan', {
|
|
41
|
+
plan_key: z.string().describe('The plan key to stop (e.g., "PROJ-PLAN")'),
|
|
42
|
+
}, async ({ plan_key }) => {
|
|
43
|
+
try {
|
|
44
|
+
const result = await client.stopBuild(plan_key);
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: 'text',
|
|
49
|
+
text: JSON.stringify(result, null, 2),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
isError: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// Get build result
|
|
67
|
+
server.tool('bamboo_get_build_result', 'Get the result of a specific build', {
|
|
68
|
+
build_key: z.string().describe('The build result key (e.g., "PROJ-PLAN-123")'),
|
|
69
|
+
expand: z.string().optional().describe('Fields to expand (e.g., "changes,artifacts,testResults")'),
|
|
70
|
+
}, async ({ build_key, expand }) => {
|
|
71
|
+
try {
|
|
72
|
+
const result = await client.getBuildResult(build_key, expand);
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: JSON.stringify(result, null, 2),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: 'text',
|
|
87
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
isError: true,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
// Get latest build result
|
|
95
|
+
server.tool('bamboo_get_latest_result', 'Get the latest build result for a plan', {
|
|
96
|
+
plan_key: z.string().describe('The plan key (e.g., "PROJ-PLAN")'),
|
|
97
|
+
expand: z.string().optional().describe('Fields to expand (e.g., "changes,artifacts,testResults")'),
|
|
98
|
+
}, async ({ plan_key, expand }) => {
|
|
99
|
+
try {
|
|
100
|
+
const result = await client.getLatestBuildResult(plan_key, expand);
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: 'text',
|
|
105
|
+
text: JSON.stringify(result, null, 2),
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
isError: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// List build results
|
|
123
|
+
server.tool('bamboo_list_build_results', 'List build results with optional filters', {
|
|
124
|
+
project_key: z.string().optional().describe('Filter by project key'),
|
|
125
|
+
plan_key: z.string().optional().describe('Filter by plan key (requires project_key)'),
|
|
126
|
+
build_state: z.string().optional().describe('Filter by build state (e.g., "Successful", "Failed")'),
|
|
127
|
+
start_index: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
128
|
+
max_results: z.number().optional().describe('Maximum number of results to return (default: 25)'),
|
|
129
|
+
expand: z.string().optional().describe('Fields to expand in the response'),
|
|
130
|
+
include_all_states: z.boolean().optional().describe('Include all build states including in-progress'),
|
|
131
|
+
}, async ({ project_key, plan_key, build_state, start_index, max_results, expand, include_all_states }) => {
|
|
132
|
+
try {
|
|
133
|
+
const results = await client.listBuildResults({
|
|
134
|
+
projectKey: project_key,
|
|
135
|
+
planKey: plan_key,
|
|
136
|
+
buildState: build_state,
|
|
137
|
+
startIndex: start_index,
|
|
138
|
+
maxResults: max_results,
|
|
139
|
+
expand,
|
|
140
|
+
includeAllStates: include_all_states,
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: 'text',
|
|
146
|
+
text: JSON.stringify(results, null, 2),
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
return {
|
|
153
|
+
content: [
|
|
154
|
+
{
|
|
155
|
+
type: 'text',
|
|
156
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
isError: true,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// Get build logs
|
|
164
|
+
server.tool('bamboo_get_build_logs', 'Get the build logs for a specific build. Returns log file URLs that can be accessed via browser.', {
|
|
165
|
+
build_key: z.string().describe('The build result key (e.g., "PROJ-PLAN-123")'),
|
|
166
|
+
job_key: z.string().optional().describe('Specific job key to get logs for'),
|
|
167
|
+
}, async ({ build_key, job_key }) => {
|
|
168
|
+
try {
|
|
169
|
+
const logs = await client.getBuildLogs(build_key, job_key);
|
|
170
|
+
return {
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: 'text',
|
|
174
|
+
text: JSON.stringify(logs, null, 2),
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return {
|
|
181
|
+
content: [
|
|
182
|
+
{
|
|
183
|
+
type: 'text',
|
|
184
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
isError: true,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
// Get build result with log content
|
|
192
|
+
server.tool('bamboo_get_build_result_logs', 'Get build result with actual log content. For plan builds, fetches logs from all jobs. For job builds, returns logs directly.', {
|
|
193
|
+
build_key: z.string().describe('The build result key - can be plan level (e.g., "PROJ-PLAN-123") or job level (e.g., "PROJ-PLAN-JOB1-123")'),
|
|
194
|
+
max_log_lines: z.number().optional().describe('Maximum number of log lines per job (default: 100)'),
|
|
195
|
+
}, async ({ build_key, max_log_lines }) => {
|
|
196
|
+
try {
|
|
197
|
+
const result = await client.getBuildResultWithLogs(build_key, {
|
|
198
|
+
maxLogLines: max_log_lines,
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: JSON.stringify(result, null, 2),
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
return {
|
|
211
|
+
content: [
|
|
212
|
+
{
|
|
213
|
+
type: 'text',
|
|
214
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
isError: true,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDeploymentTools(server, client) {
|
|
3
|
+
// List deployment projects
|
|
4
|
+
server.tool('bamboo_list_deployment_projects', 'List all Bamboo deployment projects', {}, async () => {
|
|
5
|
+
try {
|
|
6
|
+
const projects = await client.listDeploymentProjects();
|
|
7
|
+
return {
|
|
8
|
+
content: [
|
|
9
|
+
{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: JSON.stringify(projects, null, 2),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: 'text',
|
|
21
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
isError: true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// Get deployment project
|
|
29
|
+
server.tool('bamboo_get_deployment_project', 'Get details of a specific deployment project', {
|
|
30
|
+
project_id: z.string().describe('The deployment project ID'),
|
|
31
|
+
}, async ({ project_id }) => {
|
|
32
|
+
try {
|
|
33
|
+
const project = await client.getDeploymentProject(project_id);
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: JSON.stringify(project, null, 2),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Trigger deployment
|
|
56
|
+
server.tool('bamboo_trigger_deployment', 'Trigger a deployment to an environment', {
|
|
57
|
+
version_id: z.string().describe('The release version ID to deploy'),
|
|
58
|
+
environment_id: z.string().describe('The target environment ID'),
|
|
59
|
+
}, async ({ version_id, environment_id }) => {
|
|
60
|
+
try {
|
|
61
|
+
const result = await client.triggerDeployment(version_id, environment_id);
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: 'text',
|
|
66
|
+
text: JSON.stringify(result, null, 2),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
isError: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// Get deployment results
|
|
84
|
+
server.tool('bamboo_get_deployment_results', 'Get deployment results for an environment', {
|
|
85
|
+
environment_id: z.string().describe('The environment ID'),
|
|
86
|
+
start_index: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
87
|
+
max_results: z.number().optional().describe('Maximum number of results to return (default: 25)'),
|
|
88
|
+
}, async ({ environment_id, start_index, max_results }) => {
|
|
89
|
+
try {
|
|
90
|
+
const results = await client.getDeploymentResults(environment_id, {
|
|
91
|
+
startIndex: start_index,
|
|
92
|
+
maxResults: max_results,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: JSON.stringify(results, null, 2),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: 'text',
|
|
108
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
isError: true,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
// Get deployment result with logs
|
|
116
|
+
server.tool('bamboo_get_deployment_result', 'Get a specific deployment result with optional logs', {
|
|
117
|
+
deployment_result_id: z.string().describe('The deployment result ID'),
|
|
118
|
+
include_logs: z.boolean().optional().describe('Include log entries (default: false)'),
|
|
119
|
+
max_log_lines: z.number().optional().describe('Maximum number of log lines to return, most recent first (default: 100)'),
|
|
120
|
+
}, async ({ deployment_result_id, include_logs, max_log_lines }) => {
|
|
121
|
+
try {
|
|
122
|
+
const result = await client.getDeploymentResult(deployment_result_id, {
|
|
123
|
+
includeLogs: include_logs,
|
|
124
|
+
maxLogLines: max_log_lines,
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: 'text',
|
|
130
|
+
text: JSON.stringify(result, null, 2),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
return {
|
|
137
|
+
content: [
|
|
138
|
+
{
|
|
139
|
+
type: 'text',
|
|
140
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
isError: true,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerPlanTools(server, client) {
|
|
3
|
+
// List plans
|
|
4
|
+
server.tool('bamboo_list_plans', 'List all Bamboo build plans', {
|
|
5
|
+
expand: z.string().optional().describe('Fields to expand in the response (e.g., "plans.plan.stages")'),
|
|
6
|
+
start_index: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
7
|
+
max_results: z.number().optional().describe('Maximum number of results to return (default: 25)'),
|
|
8
|
+
}, async ({ expand, start_index, max_results }) => {
|
|
9
|
+
try {
|
|
10
|
+
const plans = await client.listPlans({
|
|
11
|
+
expand,
|
|
12
|
+
startIndex: start_index,
|
|
13
|
+
maxResults: max_results,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify(plans, null, 2),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
isError: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
// Get plan
|
|
37
|
+
server.tool('bamboo_get_plan', 'Get details of a specific Bamboo build plan by key', {
|
|
38
|
+
plan_key: z.string().describe('The plan key (e.g., "PROJ-PLAN")'),
|
|
39
|
+
expand: z.string().optional().describe('Fields to expand in the response'),
|
|
40
|
+
}, async ({ plan_key, expand }) => {
|
|
41
|
+
try {
|
|
42
|
+
const plan = await client.getPlan(plan_key, expand);
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: JSON.stringify(plan, null, 2),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// Search plans
|
|
65
|
+
server.tool('bamboo_search_plans', 'Search for Bamboo build plans by name', {
|
|
66
|
+
name: z.string().describe('The plan name to search for'),
|
|
67
|
+
fuzzy: z.boolean().optional().describe('Enable fuzzy matching (default: true)'),
|
|
68
|
+
start_index: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
69
|
+
max_results: z.number().optional().describe('Maximum number of results to return (default: 25)'),
|
|
70
|
+
}, async ({ name, fuzzy, start_index, max_results }) => {
|
|
71
|
+
try {
|
|
72
|
+
const plans = await client.searchPlans(name, {
|
|
73
|
+
fuzzy,
|
|
74
|
+
startIndex: start_index,
|
|
75
|
+
maxResults: max_results,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: JSON.stringify(plans, null, 2),
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: 'text',
|
|
91
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
isError: true,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
// Enable plan
|
|
99
|
+
server.tool('bamboo_enable_plan', 'Enable a Bamboo build plan', {
|
|
100
|
+
plan_key: z.string().describe('The plan key to enable (e.g., "PROJ-PLAN")'),
|
|
101
|
+
}, async ({ plan_key }) => {
|
|
102
|
+
try {
|
|
103
|
+
await client.enablePlan(plan_key);
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: 'text',
|
|
108
|
+
text: `Plan ${plan_key} has been enabled successfully.`,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: 'text',
|
|
118
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
// Disable plan
|
|
126
|
+
server.tool('bamboo_disable_plan', 'Disable a Bamboo build plan', {
|
|
127
|
+
plan_key: z.string().describe('The plan key to disable (e.g., "PROJ-PLAN")'),
|
|
128
|
+
}, async ({ plan_key }) => {
|
|
129
|
+
try {
|
|
130
|
+
await client.disablePlan(plan_key);
|
|
131
|
+
return {
|
|
132
|
+
content: [
|
|
133
|
+
{
|
|
134
|
+
type: 'text',
|
|
135
|
+
text: `Plan ${plan_key} has been disabled successfully.`,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
return {
|
|
142
|
+
content: [
|
|
143
|
+
{
|
|
144
|
+
type: 'text',
|
|
145
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
isError: true,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerProjectTools(server, client) {
|
|
3
|
+
// List projects
|
|
4
|
+
server.tool('bamboo_list_projects', 'List all Bamboo projects', {
|
|
5
|
+
expand: z.string().optional().describe('Fields to expand in the response (e.g., "projects.project.plans")'),
|
|
6
|
+
start_index: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
7
|
+
max_results: z.number().optional().describe('Maximum number of results to return (default: 25)'),
|
|
8
|
+
}, async ({ expand, start_index, max_results }) => {
|
|
9
|
+
try {
|
|
10
|
+
const projects = await client.listProjects({
|
|
11
|
+
expand,
|
|
12
|
+
startIndex: start_index,
|
|
13
|
+
maxResults: max_results,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify(projects, null, 2),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
isError: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
// Get project
|
|
37
|
+
server.tool('bamboo_get_project', 'Get details of a specific Bamboo project by key', {
|
|
38
|
+
project_key: z.string().describe('The project key (e.g., "PROJ")'),
|
|
39
|
+
expand: z.string().optional().describe('Fields to expand in the response'),
|
|
40
|
+
}, async ({ project_key, expand }) => {
|
|
41
|
+
try {
|
|
42
|
+
const project = await client.getProject(project_key, expand);
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: JSON.stringify(project, null, 2),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerQueueTools(server, client) {
|
|
3
|
+
// Get build queue
|
|
4
|
+
server.tool('bamboo_get_build_queue', 'Get the current Bamboo build queue', {
|
|
5
|
+
expand: z.string().optional().describe('Fields to expand (default: "queuedBuilds")'),
|
|
6
|
+
}, async ({ expand }) => {
|
|
7
|
+
try {
|
|
8
|
+
const queue = await client.getBuildQueue(expand);
|
|
9
|
+
return {
|
|
10
|
+
content: [
|
|
11
|
+
{
|
|
12
|
+
type: 'text',
|
|
13
|
+
text: JSON.stringify(queue, null, 2),
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
return {
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// Get deployment queue
|
|
31
|
+
server.tool('bamboo_get_deployment_queue', 'Get the current Bamboo deployment queue', {}, async () => {
|
|
32
|
+
try {
|
|
33
|
+
const queue = await client.getDeploymentQueue();
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: JSON.stringify(queue, null, 2),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|