@@ -44,54 +44,21 @@ export const createListAccountsTool = (env: Env) =>
4444 nextPageToken : z . string ( ) . optional ( ) ,
4545 } ) ,
4646 execute : async ( { context } ) => {
47- console . log (
48- "[list_accounts] Starting with pageToken:" ,
49- context . pageToken ,
50- ) ;
51-
5247 const client = new GTMClient ( {
5348 accessToken : getAccessToken ( env ) ,
5449 } ) ;
5550
5651 const response = await client . listAccounts ( context . pageToken ) ;
5752
58- console . log ( "[list_accounts] Raw response structure:" ) ;
59- console . log ( "- Type:" , typeof response ) ;
60- console . log ( "- Keys:" , Object . keys ( response ) ) ;
61- console . log ( "- Has 'account' property:" , "account" in response ) ;
62- console . log (
63- "- 'account' type:" ,
64- Array . isArray ( response . account ) ? "Array" : typeof response . account ,
65- ) ;
66- console . log ( "- 'account' length:" , response . account ?. length ) ;
67-
68- if ( response . account && response . account . length > 0 ) {
69- console . log ( "[list_accounts] First account structure:" ) ;
70- console . log ( JSON . stringify ( response . account [ 0 ] , null , 2 ) ) ;
71- }
72-
73- const accounts = ( response . account || [ ] ) . map ( ( acc ) => {
74- console . log (
75- "[list_accounts] Processing account:" ,
76- acc . accountId ,
77- acc . name ,
78- ) ;
79- return {
80- path : acc . path ,
81- accountId : acc . accountId ,
82- name : acc . name ,
83- ...( acc . shareData !== undefined && { shareData : acc . shareData } ) ,
84- ...( acc . fingerprint && { fingerprint : acc . fingerprint } ) ,
85- ...( acc . tagManagerUrl && { tagManagerUrl : acc . tagManagerUrl } ) ,
86- ...( acc . features && { features : acc . features } ) ,
87- } ;
88- } ) ;
89-
90- console . log (
91- "[list_accounts] Returning result with" ,
92- accounts . length ,
93- "accounts" ,
94- ) ;
53+ const accounts = ( response . account || [ ] ) . map ( ( acc ) => ( {
54+ path : acc . path ,
55+ accountId : acc . accountId ,
56+ name : acc . name ,
57+ ...( acc . shareData !== undefined && { shareData : acc . shareData } ) ,
58+ ...( acc . fingerprint && { fingerprint : acc . fingerprint } ) ,
59+ ...( acc . tagManagerUrl && { tagManagerUrl : acc . tagManagerUrl } ) ,
60+ ...( acc . features && { features : acc . features } ) ,
61+ } ) ) ;
9562
9663 return {
9764 accounts,
0 commit comments