@@ -29,6 +29,17 @@ type ListPipelinesArgs struct {
2929 DetailLevel string `json:"detail_level"` // "summary", "detailed", "full"
3030}
3131
32+ type CreatePipelineResult struct {
33+ Pipeline buildkite.Pipeline `json:"pipeline"`
34+ Webhook * WebhookInfo `json:"webhook,omitempty"`
35+ }
36+
37+ type WebhookInfo struct {
38+ Created bool `json:"created"`
39+ Error string `json:"error,omitempty"`
40+ Note string `json:"note,omitempty"`
41+ }
42+
3243func ListPipelines (client PipelinesClient ) (tool mcp.Tool , handler mcp.TypedToolHandlerFunc [ListPipelinesArgs ], scopes []string ) {
3344 return mcp .NewTool ("list_pipelines" ,
3445 mcp .WithDescription ("List all pipelines in an organization with their basic details, build counts, and current status" ),
@@ -397,29 +408,26 @@ func CreatePipeline(client PipelinesClient) (tool mcp.Tool, handler mcp.TypedToo
397408
398409 if createWebhook {
399410 _ , err := client .AddWebhook (ctx , args .OrgSlug , pipeline .Slug )
400- if err != nil {
401- result := map [string ]any {
402- "pipeline" : pipeline ,
403- "webhook" : map [string ]any {
404- "created" : false ,
405- "error" : err .Error (),
406- "note" : "Pipeline created successfully, but webhook creation failed." ,
407- },
408- }
409- return mcpTextResult (span , & result )
411+ result := CreatePipelineResult {
412+ Pipeline : pipeline ,
413+ Webhook : & WebhookInfo {
414+ Created : err == nil ,
415+ Note : "Pipeline and webhook created successfully." ,
416+ },
410417 }
411418
412- result := map [string ]any {
413- "pipeline" : pipeline ,
414- "webhook" : map [string ]any {
415- "created" : true ,
416- "note" : "Pipeline and webhook created successfully." ,
417- },
419+ if err != nil {
420+ result .Webhook .Error = err .Error ()
421+ result .Webhook .Note = "Pipeline created successfully, but webhook creation failed."
418422 }
423+
419424 return mcpTextResult (span , & result )
420425 }
421426
422- return mcpTextResult (span , & pipeline )
427+ result := CreatePipelineResult {
428+ Pipeline : pipeline ,
429+ }
430+ return mcpTextResult (span , & result )
423431 }, []string {"write_pipelines" }
424432}
425433
0 commit comments