File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,23 @@ export const xCreateTweetTool: ToolConfig<XCreateTweetParams, XCreateTweetRespon
9191
9292 transformResponse : async ( response ) => {
9393 const data = await response . json ( )
94+
95+ if ( ! data . data ) {
96+ return {
97+ success : false ,
98+ error : data . errors ?. [ 0 ] ?. detail || 'Failed to create tweet' ,
99+ output : {
100+ id : '' ,
101+ text : '' ,
102+ } ,
103+ }
104+ }
105+
94106 return {
95107 success : true ,
96108 output : {
97- id : data . data ? .id ?? '' ,
98- text : data . data ? .text ?? '' ,
109+ id : data . data . id ?? '' ,
110+ text : data . data . text ?? '' ,
99111 } ,
100112 }
101113 } ,
Original file line number Diff line number Diff line change @@ -38,10 +38,21 @@ export const xDeleteTweetTool: ToolConfig<XDeleteTweetParams, XDeleteTweetRespon
3838
3939 transformResponse : async ( response ) => {
4040 const data = await response . json ( )
41+
42+ if ( ! data . data ) {
43+ return {
44+ success : false ,
45+ error : data . errors ?. [ 0 ] ?. detail || 'Failed to delete tweet' ,
46+ output : {
47+ deleted : false ,
48+ } ,
49+ }
50+ }
51+
4152 return {
4253 success : true ,
4354 output : {
44- deleted : data . data ? .deleted ?? false ,
55+ deleted : data . data . deleted ?? false ,
4556 } ,
4657 }
4758 } ,
You can’t perform that action at this time.
0 commit comments