File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,26 @@ server.tool(
182182 }
183183) ;
184184
185+ server . tool (
186+ "get-run-logs" ,
187+ "Retrieve the logs output of a task run." ,
188+ {
189+ runId : z . string ( ) . describe ( "The ID of the task run to get" ) ,
190+ } ,
191+ async ( { runId } ) => {
192+ const result = await sdkApiClient . listRunEvents ( runId ) ;
193+
194+ return {
195+ content : [
196+ {
197+ text : JSON . stringify ( result , null , 2 ) ,
198+ type : "text" ,
199+ } ,
200+ ] ,
201+ } ;
202+ }
203+ ) ;
204+
185205const app = polka ( ) ;
186206app . get ( "/sse" , ( _req , res ) => {
187207 mcpTransport = new SSEServerTransport ( "/messages" , res ) ;
Original file line number Diff line number Diff line change @@ -404,6 +404,18 @@ export class ApiClient {
404404 ) ;
405405 }
406406
407+ listRunEvents ( runId : string , requestOptions ?: ZodFetchOptions ) {
408+ return zodfetch (
409+ z . any ( ) , // TODO: define a proper schema for this
410+ `${ this . baseUrl } /api/v1/runs/${ runId } /events` ,
411+ {
412+ method : "GET" ,
413+ headers : this . #getHeaders( false ) ,
414+ } ,
415+ mergeRequestOptions ( this . defaultRequestOptions , requestOptions )
416+ ) ;
417+ }
418+
407419 addTags ( runId : string , body : AddTagsRequestBody , requestOptions ?: ZodFetchOptions ) {
408420 return zodfetch (
409421 z . object ( { message : z . string ( ) } ) ,
You can’t perform that action at this time.
0 commit comments