Skip to content

Add Godot ClassDB API introspection#553

Merged
dsarno merged 2 commits into
hi-godot:mainfrom
Clubhouse1661:api-class-introspection
Jun 12, 2026
Merged

Add Godot ClassDB API introspection#553
dsarno merged 2 commits into
hi-godot:mainfrom
Clubhouse1661:api-class-introspection

Conversation

@Clubhouse1661

@Clubhouse1661 Clubhouse1661 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #552

Summary

Adds version-correct Godot API introspection backed by the running editor’s ClassDB.

  • Adds api_manage(op="get_class")
  • Adds godot://class/{class_name}
  • Returns class metadata: properties, hints, defaults, methods, signals, enums, constants, inheritance, and optional inheritors
  • Keeps default payloads small with direct members only plus section pagination
  • Documents that callers should page one requested section at a time
  • Adds clear errors for project script class_name lookups, invalid sections, and negative limits
  • Enriches resource_manage(op="get_info") with hint_string, property defaults, and property class names while keeping the Resource-only is_abstract field
  • Shares fuzzy suggestion ranking for typos

Testing

  • ruff check src tests
  • Focused MCP/Python suite: 505 passed
  • Live Godot 4.6.3 MCP suites: api 9/9, resource 41/41, node 131/131 passed

@Clubhouse1661 Clubhouse1661 force-pushed the api-class-introspection branch from 2868be5 to 63f513d Compare June 11, 2026 22:14
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dsarno dsarno left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with the branch checked out locally: ruff clean, 880 unit + 290 integration tests pass, and all 15 CI checks (including the Godot 4.3 canary) are green. I also verified the new ClassDB calls (class_get_property_default_value, is_class_enum_bitfield, class_get_integer_constant_enum, get_global_class_list) all exist in Godot 4.3, so the version floor is intact.

Overall this is solid — it follows the AGENTS.md tool-change checklist end to end, the VariantSerializer/FuzzySuggestions extractions are behavior-preserving, and the error UX (typo suggestions, script-class redirect to script_manage) is thoughtful. Five non-blocking comments inline.

Smaller follow-up candidates, not blocking: VariantSerializer is missing TYPE_PACKED_VECTOR4_ARRAY in its array branch (pre-existing, but cheap to fix while extracting; the type exists in 4.3+), and handlers/_property_errors.gd still carries its own similarity ranker that could move to FuzzySuggestions later.


Generated by Claude Code

Comment thread src/godot_ai/handlers/editor.py Outdated
Comment thread plugin/addons/godot_ai/utils/class_introspection.gd
Comment thread plugin/addons/godot_ai/handlers/resource_handler.gd
Comment thread plugin/addons/godot_ai/utils/class_introspection.gd Outdated
Comment thread plugin/addons/godot_ai/utils/class_introspection.gd Outdated
@Clubhouse1661

Clubhouse1661 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review.
I addressed your feedback in a new commit 7c07fed:

  • Dropped the unrelated editor.py reload-delay hunk.
  • Documented that offset/limit pagination should be used one section at a time.
  • Kept the resource_manage(op="get_info") defaults enrichment intentionally, updated the PR description, and added a BoxMesh.size default assertion.
  • Removed is_abstract from general api_manage class output and added is_singleton; resource_manage(get_info) keeps its Resource-only is_abstract field.
  • Negative limit now returns INVALID_PARAMS.
  • Added TYPE_PACKED_VECTOR4_ARRAY serialization.

dsarno commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Thank you @Clubhouse1661 — this is a great addition! Version-correct ClassDB introspection straight from the running editor closes a real gap, and the execution here was a pleasure to review: the tool + resource forms follow the repo conventions exactly, the error UX (typo suggestions, the script_manage redirect for project script classes) is genuinely thoughtful, and every round of review feedback came back addressed with tests. Much appreciated! 🎉


Generated by Claude Code

@dsarno dsarno merged commit 20ff47e into hi-godot:main Jun 12, 2026
15 checks passed
@Clubhouse1661 Clubhouse1661 deleted the api-class-introspection branch June 12, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ClassDB-based class introspection

2 participants