@@ -58,7 +58,7 @@ func create_player(params: Dictionary) -> Dictionary:
5858 if not parent_path .is_empty ():
5959 parent = McpScenePath .resolve (parent_path , scene_root )
6060 if parent == null :
61- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , McpScenePath .format_parent_error (parent_path , scene_root ))
61+ return McpErrorCodes .make (McpErrorCodes .NODE_NOT_FOUND , McpScenePath .format_parent_error (parent_path , scene_root ))
6262
6363 var player := AnimationPlayer .new ()
6464 if not node_name .is_empty ():
@@ -97,14 +97,14 @@ func create_animation(params: Dictionary) -> Dictionary:
9797 var loop_mode_str : String = params .get ("loop_mode" , "none" )
9898
9999 if player_path .is_empty ():
100- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
100+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
101101 if anim_name .is_empty ():
102- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: name" )
102+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: name" )
103103 if length <= 0.0 :
104- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "length must be > 0 (got %s )" % length )
104+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE , "length must be > 0 (got %s )" % length )
105105
106106 if not _LOOP_MODES .has (loop_mode_str ):
107- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
107+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE ,
108108 "Invalid loop_mode '%s '. Valid: %s " % [loop_mode_str , ", " .join (_LOOP_MODES .keys ())])
109109
110110 var resolved := _resolve_player (player_path , true )
@@ -158,9 +158,9 @@ func delete_animation(params: Dictionary) -> Dictionary:
158158 var anim_name : String = params .get ("animation_name" , "" )
159159
160160 if player_path .is_empty ():
161- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
161+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
162162 if anim_name .is_empty ():
163- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: animation_name" )
163+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: animation_name" )
164164
165165 var resolved := _resolve_player (player_path )
166166 if resolved .has ("error" ):
@@ -210,17 +210,17 @@ func add_property_track(params: Dictionary) -> Dictionary:
210210 var interp_str : String = params .get ("interpolation" , "linear" )
211211
212212 if player_path .is_empty ():
213- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
213+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
214214 if anim_name .is_empty ():
215- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: animation_name" )
215+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: animation_name" )
216216 if track_path .is_empty ():
217217 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
218218 "Missing required param: track_path (format: 'NodeName:property', e.g. 'Panel:modulate')" )
219219 if not track_path .contains (":" ):
220220 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
221221 "track_path must include ':property' suffix (e.g. 'Panel:modulate', '.:position')" )
222222 if not _INTERP_MODES .has (interp_str ):
223- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
223+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE ,
224224 "Invalid interpolation '%s '. Valid: %s " % [interp_str , ", " .join (_INTERP_MODES .keys ())])
225225 if typeof (keyframes ) != TYPE_ARRAY or keyframes .is_empty ():
226226 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "keyframes must be a non-empty array" )
@@ -247,9 +247,9 @@ func add_property_track(params: Dictionary) -> Dictionary:
247247 if typeof (kf ) != TYPE_DICTIONARY :
248248 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must be a dictionary" )
249249 if not "time" in kf :
250- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must have a 'time' field" )
250+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Each keyframe must have a 'time' field" )
251251 if not "value" in kf :
252- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must have a 'value' field" )
252+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Each keyframe must have a 'value' field" )
253253 var coerce_result := AnimationValues .coerce_with_context (kf .get ("value" ), ctx )
254254 if coerce_result .has ("error" ):
255255 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , coerce_result .error )
@@ -309,11 +309,11 @@ func add_method_track(params: Dictionary) -> Dictionary:
309309 var keyframes = params .get ("keyframes" , [])
310310
311311 if player_path .is_empty ():
312- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
312+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
313313 if anim_name .is_empty ():
314- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: animation_name" )
314+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: animation_name" )
315315 if target_path .is_empty ():
316- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: target_node_path" )
316+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: target_node_path" )
317317 if target_path .contains (":" ):
318318 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
319319 "target_node_path is a bare NodePath without ':property' (got '%s '). " % target_path +
@@ -325,9 +325,9 @@ func add_method_track(params: Dictionary) -> Dictionary:
325325 if typeof (kf ) != TYPE_DICTIONARY :
326326 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must be a dictionary" )
327327 if not "time" in kf :
328- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must have a 'time' field" )
328+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Each keyframe must have a 'time' field" )
329329 if not "method" in kf :
330- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each keyframe must have a 'method' field" )
330+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Each keyframe must have a 'method' field" )
331331 var method_field = kf .get ("method" )
332332 if typeof (method_field ) != TYPE_STRING or (method_field as String ).is_empty ():
333333 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "'method' must be a non-empty string" )
@@ -391,7 +391,7 @@ func set_autoplay(params: Dictionary) -> Dictionary:
391391 var anim_name : String = params .get ("animation_name" , "" )
392392
393393 if player_path .is_empty ():
394- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
394+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
395395
396396 var resolved := _resolve_player (player_path )
397397 if resolved .has ("error" ):
@@ -400,7 +400,7 @@ func set_autoplay(params: Dictionary) -> Dictionary:
400400
401401 # Allow empty string to clear autoplay; otherwise validate the name exists.
402402 if not anim_name .is_empty () and not player .has_animation (anim_name ):
403- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
403+ return McpErrorCodes .make (McpErrorCodes .PROPERTY_NOT_ON_CLASS ,
404404 "Animation '%s ' not found on player at %s " % [anim_name , player_path ])
405405
406406 var old_autoplay : String = player .autoplay
@@ -430,15 +430,15 @@ func play(params: Dictionary) -> Dictionary:
430430 var anim_name : String = params .get ("animation_name" , "" )
431431
432432 if player_path .is_empty ():
433- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
433+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
434434
435435 var resolved := _resolve_player (player_path )
436436 if resolved .has ("error" ):
437437 return resolved
438438 var player : AnimationPlayer = resolved .player
439439
440440 if not anim_name .is_empty () and not player .has_animation (anim_name ):
441- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
441+ return McpErrorCodes .make (McpErrorCodes .PROPERTY_NOT_ON_CLASS ,
442442 "Animation '%s ' not found on player at %s " % [anim_name , player_path ])
443443
444444 player .play (anim_name )
@@ -461,7 +461,7 @@ func stop(params: Dictionary) -> Dictionary:
461461 var player_path : String = params .get ("player_path" , "" )
462462
463463 if player_path .is_empty ():
464- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
464+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
465465
466466 var resolved := _resolve_player (player_path )
467467 if resolved .has ("error" ):
@@ -490,13 +490,13 @@ func create_simple(params: Dictionary) -> Dictionary:
490490 var loop_mode_str : String = params .get ("loop_mode" , "none" )
491491
492492 if player_path .is_empty ():
493- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: player_path" )
493+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: player_path" )
494494 if anim_name .is_empty ():
495- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Missing required param: name" )
495+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM , "Missing required param: name" )
496496 if typeof (tweens ) != TYPE_ARRAY or tweens .is_empty ():
497497 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "tweens must be a non-empty array" )
498498 if not _LOOP_MODES .has (loop_mode_str ):
499- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
499+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE ,
500500 "Invalid loop_mode '%s '. Valid: %s " % [loop_mode_str , ", " .join (_LOOP_MODES .keys ())])
501501
502502 # Validate all tween specs before touching the scene.
@@ -506,10 +506,10 @@ func create_simple(params: Dictionary) -> Dictionary:
506506 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , "Each tween spec must be a dictionary" )
507507 for field in ["target" , "property" , "from" , "to" , "duration" ]:
508508 if not field in spec :
509- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
509+ return McpErrorCodes .make (McpErrorCodes .MISSING_REQUIRED_PARAM ,
510510 "Each tween spec must have '%s '" % field )
511511 if float (spec .get ("duration" , 0.0 )) <= 0.0 :
512- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
512+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE ,
513513 "tween 'duration' must be > 0" )
514514 var dup_key : String = str (spec .target ) + ":" + str (spec .property )
515515 if seen_paths .has (dup_key ):
@@ -525,7 +525,7 @@ func create_simple(params: Dictionary) -> Dictionary:
525525 if has_length :
526526 computed_length = float (params .get ("length" ))
527527 if computed_length <= 0.0 :
528- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
528+ return McpErrorCodes .make (McpErrorCodes .VALUE_OUT_OF_RANGE ,
529529 "'length' must be > 0 when provided (got %s )" % str (params .get ("length" )))
530530 else :
531531 for spec in tweens :
@@ -732,7 +732,7 @@ func _resolve_player(player_path: String, create_if_missing: bool = false) -> Di
732732 var node := McpScenePath .resolve (player_path , scene_root )
733733 if node == null :
734734 if not create_if_missing :
735- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , McpScenePath .format_node_error (player_path , scene_root ))
735+ return McpErrorCodes .make (McpErrorCodes .NODE_NOT_FOUND , McpScenePath .format_node_error (player_path , scene_root ))
736736 return _instantiate_player (player_path , scene_root )
737737 if not node is AnimationPlayer :
738738 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
@@ -814,7 +814,7 @@ func _resolve_or_create_player(player_path: String) -> Dictionary:
814814 else :
815815 parent = McpScenePath .resolve (parent_path , scene_root )
816816 if parent == null :
817- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
817+ return McpErrorCodes .make (McpErrorCodes .NODE_NOT_FOUND ,
818818 "Node not found: %s (and its parent %s also does not exist — create the parent first)" %
819819 [player_path , parent_path ])
820820 var new_player := AnimationPlayer .new ()
@@ -834,7 +834,7 @@ func _resolve_player_read(player_path: String) -> Dictionary:
834834 return McpErrorCodes .make (McpErrorCodes .EDITOR_NOT_READY , "No scene open" )
835835 var node := McpScenePath .resolve (player_path , scene_root )
836836 if node == null :
837- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS , McpScenePath .format_node_error (player_path , scene_root ))
837+ return McpErrorCodes .make (McpErrorCodes .NODE_NOT_FOUND , McpScenePath .format_node_error (player_path , scene_root ))
838838 if not node is AnimationPlayer :
839839 return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
840840 "Node at %s is not an AnimationPlayer (got %s )" % [player_path , node .get_class ()])
@@ -846,7 +846,7 @@ func _resolve_player_read(player_path: String) -> Dictionary:
846846## as returned by `list_animations` for non-default libraries.
847847func _resolve_animation (player : AnimationPlayer , anim_name : String ) -> Dictionary :
848848 if not player .has_animation (anim_name ):
849- return McpErrorCodes .make (McpErrorCodes .INVALID_PARAMS ,
849+ return McpErrorCodes .make (McpErrorCodes .PROPERTY_NOT_ON_CLASS ,
850850 "Animation '%s ' not found on player. Available: %s " % [
851851 anim_name ,
852852 ", " .join (Array (player .get_animation_list ()))
0 commit comments