@@ -491,15 +491,6 @@ module.exports = function(config, options) {
491491 async function executeDatabaseFunction ( functionName , args , appContext , operationLog = [ ] ) {
492492 const Parse = require ( 'parse/node' ) ;
493493
494- // Debug logging for all Parse Server requests
495- console . log ( 'Parse Server Request:' , {
496- operation : functionName ,
497- args : args ,
498- appId : appContext . appId ,
499- serverURL : appContext . serverURL ,
500- timestamp : new Date ( ) . toISOString ( )
501- } ) ;
502-
503494 // Initialize Parse for this app context
504495 Parse . initialize ( appContext . appId , undefined , appContext . masterKey ) ;
505496 Parse . serverURL = appContext . serverURL ;
@@ -558,21 +549,6 @@ module.exports = function(config, options) {
558549 timestamp : new Date ( ) . toISOString ( )
559550 } ;
560551
561- // Log Parse SDK operation details
562- console . log ( 'Parse SDK Operation:' , {
563- method : 'Query.find()' ,
564- className,
565- constraints : where ,
566- limit,
567- skip,
568- order,
569- include,
570- select,
571- resultCount : results . length ,
572- useMasterKey : true
573- } ) ;
574-
575- console . log ( 'Parse Server Response:' , operationSummary ) ;
576552 operationLog . push ( operationSummary ) ;
577553 return resultData ;
578554 }
@@ -597,30 +573,9 @@ module.exports = function(config, options) {
597573 object . set ( key , objectData [ key ] ) ;
598574 } ) ;
599575
600- // Log Parse SDK operation details
601- console . log ( 'Parse SDK Operation:' , {
602- method : 'ParseObject.save()' ,
603- className,
604- data : objectData ,
605- useMasterKey : true
606- } ) ;
607-
608576 const result = await object . save ( null , { useMasterKey : true } ) ;
609577 const resultData = result . toJSON ( ) ;
610578
611- console . log ( 'Parse SDK Result:' , {
612- method : 'ParseObject.save()' ,
613- className,
614- objectId : resultData . objectId ,
615- createdAt : resultData . createdAt
616- } ) ;
617-
618- console . log ( 'Parse Server Response:' , {
619- operation : 'createObject' ,
620- className,
621- objectId : resultData . objectId ,
622- timestamp : new Date ( ) . toISOString ( )
623- } ) ;
624579 return resultData ;
625580 }
626581
@@ -632,53 +587,16 @@ module.exports = function(config, options) {
632587 throw new Error ( `Updating objects requires user confirmation. The AI should ask for permission before updating object ${ objectId } in the ${ className } class.` ) ;
633588 }
634589
635- // Log Parse SDK operation details for getting the object
636- console . log ( 'Parse SDK Operation:' , {
637- method : 'Query.get()' ,
638- className,
639- objectId,
640- useMasterKey : true
641- } ) ;
642-
643590 const query = new Parse . Query ( className ) ;
644591 const object = await query . get ( objectId , { useMasterKey : true } ) ;
645592
646- console . log ( 'Parse SDK Result:' , {
647- method : 'Query.get()' ,
648- className,
649- objectId,
650- found : true
651- } ) ;
652-
653593 Object . keys ( objectData ) . forEach ( key => {
654594 object . set ( key , objectData [ key ] ) ;
655595 } ) ;
656596
657- // Log Parse SDK operation details for saving the updated object
658- console . log ( 'Parse SDK Operation:' , {
659- method : 'ParseObject.save() [update]' ,
660- className,
661- objectId,
662- updateData : objectData ,
663- useMasterKey : true
664- } ) ;
665-
666597 const result = await object . save ( null , { useMasterKey : true } ) ;
667598 const resultData = result . toJSON ( ) ;
668599
669- console . log ( 'Parse SDK Result:' , {
670- method : 'ParseObject.save() [update]' ,
671- className,
672- objectId,
673- updatedAt : resultData . updatedAt
674- } ) ;
675-
676- console . log ( 'Parse Server Response:' , {
677- operation : 'updateObject' ,
678- className,
679- objectId,
680- timestamp : new Date ( ) . toISOString ( )
681- } ) ;
682600 return resultData ;
683601 }
684602
@@ -690,94 +608,22 @@ module.exports = function(config, options) {
690608 throw new Error ( `Deleting objects requires user confirmation. The AI should ask for permission before permanently deleting object ${ objectId } from the ${ className } class.` ) ;
691609 }
692610
693- // Log Parse SDK operation details for getting the object
694- console . log ( 'Parse SDK Operation:' , {
695- method : 'Query.get()' ,
696- className,
697- objectId,
698- useMasterKey : true
699- } ) ;
700-
701611 const query = new Parse . Query ( className ) ;
702612 const object = await query . get ( objectId , { useMasterKey : true } ) ;
703613
704- console . log ( 'Parse SDK Result:' , {
705- method : 'Query.get()' ,
706- className,
707- objectId,
708- found : true
709- } ) ;
710-
711- // Log Parse SDK operation details for deleting the object
712- console . log ( 'Parse SDK Operation:' , {
713- method : 'ParseObject.destroy()' ,
714- className,
715- objectId,
716- useMasterKey : true
717- } ) ;
718-
719614 await object . destroy ( { useMasterKey : true } ) ;
720615
721- console . log ( 'Parse SDK Result:' , {
722- method : 'ParseObject.destroy()' ,
723- className,
724- objectId,
725- deleted : true
726- } ) ;
727-
728616 const result = { success : true , objectId } ;
729- console . log ( 'Parse Server Response:' , {
730- operation : 'deleteObject' ,
731- className,
732- objectId,
733- timestamp : new Date ( ) . toISOString ( )
734- } ) ;
735617 return result ;
736618 }
737619
738620 case 'getSchema' : {
739621 const { className } = args ;
740622 let result ;
741623 if ( className ) {
742- // Log Parse SDK operation details for getting a specific schema
743- console . log ( 'Parse SDK Operation:' , {
744- method : 'Parse.Schema.get()' ,
745- className
746- } ) ;
747-
748624 result = await new Parse . Schema ( className ) . get ( ) ;
749-
750- console . log ( 'Parse SDK Result:' , {
751- method : 'Parse.Schema.get()' ,
752- className,
753- fields : Object . keys ( result . fields || { } ) . length
754- } ) ;
755-
756- console . log ( 'Parse Server Response:' , {
757- operation : 'getSchema' ,
758- className,
759- timestamp : new Date ( ) . toISOString ( )
760- } ) ;
761625 } else {
762- // Log Parse SDK operation details for getting all schemas
763- console . log ( 'Parse SDK Operation:' , {
764- method : 'Parse.Schema.all()'
765- } ) ;
766-
767626 result = await Parse . Schema . all ( ) ;
768-
769- console . log ( 'Parse SDK Result:' , {
770- method : 'Parse.Schema.all()' ,
771- schemaCount : result . length ,
772- classNames : result . map ( schema => schema . className )
773- } ) ;
774-
775- console . log ( 'Parse Server Response:' , {
776- operation : 'getSchema' ,
777- action : 'getAllSchemas' ,
778- schemaCount : result . length ,
779- timestamp : new Date ( ) . toISOString ( )
780- } ) ;
781627 }
782628 return result ;
783629 }
@@ -809,29 +655,9 @@ module.exports = function(config, options) {
809655 }
810656 } ) ;
811657
812- // Log Parse SDK operation details
813- console . log ( 'Parse SDK Operation:' , {
814- method : 'Query.count()' ,
815- className,
816- constraints : where ,
817- useMasterKey : true
818- } ) ;
819-
820658 const count = await query . count ( { useMasterKey : true } ) ;
821659
822- console . log ( 'Parse SDK Result:' , {
823- method : 'Query.count()' ,
824- className,
825- count
826- } ) ;
827-
828660 const result = { count } ;
829- console . log ( 'Parse Server Response:' , {
830- operation : 'countObjects' ,
831- className,
832- count,
833- timestamp : new Date ( ) . toISOString ( )
834- } ) ;
835661 return result ;
836662 }
837663
@@ -843,14 +669,6 @@ module.exports = function(config, options) {
843669 throw new Error ( `Creating classes requires user confirmation. The AI should ask for permission before creating the ${ className } class.` ) ;
844670 }
845671
846- // Log Parse SDK operation details
847- console . log ( 'Parse SDK Operation:' , {
848- method : 'new Parse.Schema().save()' ,
849- className,
850- fields,
851- useMasterKey : true
852- } ) ;
853-
854672 const schema = new Parse . Schema ( className ) ;
855673
856674 // Add fields to the schema
@@ -890,19 +708,7 @@ module.exports = function(config, options) {
890708
891709 const result = await schema . save ( ) ;
892710
893- console . log ( 'Parse SDK Result:' , {
894- method : 'new Parse.Schema().save()' ,
895- className,
896- savedSchema : result . toJSON ( )
897- } ) ;
898-
899711 const resultData = { success : true , className, schema : result } ;
900- console . log ( 'Parse Server Response:' , {
901- operation : 'createClass' ,
902- className,
903- fieldsCount : Object . keys ( fields ) . length ,
904- timestamp : new Date ( ) . toISOString ( )
905- } ) ;
906712 return resultData ;
907713 }
908714
@@ -1075,22 +881,6 @@ You have direct access to the Parse database through function calls, so you can
1075881 const functionName = toolCall . function . name ;
1076882 const functionArgs = JSON . parse ( toolCall . function . arguments ) ;
1077883
1078- // Detailed logging to debug function call parameters
1079- console . log ( '=== FUNCTION CALL DEBUG ===' ) ;
1080- console . log ( 'Function Name:' , functionName ) ;
1081- console . log ( 'Raw Arguments String:' , toolCall . function . arguments ) ;
1082- console . log ( 'Parsed Arguments:' , functionArgs ) ;
1083- console . log ( 'Arguments Keys:' , Object . keys ( functionArgs ) ) ;
1084- if ( functionName === 'createObject' ) {
1085- console . log ( 'createObject Analysis:' ) ;
1086- console . log ( '- className:' , functionArgs . className ) ;
1087- console . log ( '- objectData:' , functionArgs . objectData ) ;
1088- console . log ( '- objectData type:' , typeof functionArgs . objectData ) ;
1089- console . log ( '- objectData keys:' , functionArgs . objectData ? Object . keys ( functionArgs . objectData ) : 'OBJECTDATA IS MISSING' ) ;
1090- console . log ( '- confirmed:' , functionArgs . confirmed ) ;
1091- }
1092- console . log ( '=== END DEBUG ===' ) ;
1093-
1094884 console . log ( 'Executing database function:' , {
1095885 functionName,
1096886 args : functionArgs ,
@@ -1099,19 +889,6 @@ You have direct access to the Parse database through function calls, so you can
1099889 timestamp : new Date ( ) . toISOString ( )
1100890 } ) ;
1101891
1102- // Special validation for createObject function calls
1103- if ( functionName === 'createObject' && ( ! functionArgs . objectData || typeof functionArgs . objectData !== 'object' || Object . keys ( functionArgs . objectData ) . length === 0 ) ) {
1104- const missingDataError = {
1105- error : 'CRITICAL ERROR: createObject function call is missing the required objectData parameter. You must provide the objectData parameter with actual field values. Example: {"className": "TestCars", "objectData": {"model": "Honda Civic", "year": 2023, "brand": "Honda"}, "confirmed": true}. Please retry the function call with the objectData parameter containing the object fields and values you want to create.'
1106- } ;
1107- toolResponses . push ( {
1108- tool_call_id : toolCall . id ,
1109- role : 'tool' ,
1110- content : JSON . stringify ( missingDataError )
1111- } ) ;
1112- continue ; // Skip to next tool call
1113- }
1114-
1115892 // Execute the database function
1116893 const result = await executeDatabaseFunction ( functionName , functionArgs , appContext , operationLog ) ;
1117894
@@ -1121,12 +898,6 @@ You have direct access to the Parse database through function calls, so you can
1121898 content : result ? JSON . stringify ( result ) : JSON . stringify ( { success : true } )
1122899 } ) ;
1123900 } catch ( error ) {
1124- console . error ( 'Parse operation error:' , {
1125- functionName : toolCall . function . name ,
1126- args : toolCall . function . arguments ,
1127- error : error . message ,
1128- stack : error . stack
1129- } ) ;
1130901 toolResponses . push ( {
1131902 tool_call_id : toolCall . id ,
1132903 role : 'tool' ,
0 commit comments