File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,12 +24,25 @@ server.tool(
2424 "trigger-task" ,
2525 "Trigger a task" ,
2626 {
27- id : z . string ( ) . describe ( "The id of the task to trigger" ) ,
27+ id : z . string ( ) . describe ( "The ID of the task to trigger" ) ,
28+ payload : z
29+ . string ( )
30+ . transform ( ( val , ctx ) => {
31+ try {
32+ return JSON . parse ( val ) ;
33+ } catch {
34+ ctx . addIssue ( {
35+ code : z . ZodIssueCode . custom ,
36+ message : "The payload must be a valid JSON string" ,
37+ } ) ;
38+ return z . NEVER ;
39+ }
40+ } )
41+ . describe ( "The payload to pass to the task run, must be a valid JSON" ) ,
2842 } ,
29- async ( { id } ) => {
43+ async ( { id, payload } ) => {
3044 const result = await sdkApiClient . triggerTask ( id , {
31- // TODO: enable the user to pass in a custom payload
32- payload : { } ,
45+ payload,
3346 } ) ;
3447
3548 const taskRunUrl = `${ dashboardUrl } /projects/v3/${ projectRef } /runs/${ result . id } ` ;
You can’t perform that action at this time.
0 commit comments