Add fetch_db_schema to DatabaseTool for compact schema introspection#216
Merged
scottpersinger merged 1 commit intosupercog-ai:mainfrom Jun 10, 2025
vivekd16:main
Merged
Add fetch_db_schema to DatabaseTool for compact schema introspection#216scottpersinger merged 1 commit intosupercog-ai:mainfrom vivekd16:main
scottpersinger merged 1 commit intosupercog-ai:mainfrom
vivekd16:main
Conversation
…and test coverage
scottpersinger
approved these changes
Jun 10, 2025
Collaborator
scottpersinger
left a comment
There was a problem hiding this comment.
Nice! Thanks @vivekd16 - this looks great.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
fetch_db_schemamethod to theDatabaseToolclass, enabling agents to retrieve a compact, human-readable schema summary for all or selected tables in a connected SQL database. This allows agents to preload schema information without requiring runtime introspection via SQL queries.Features
fetch_db_schema(thread_context, tables=None)tablesis provided, only those tables are included; otherwise, all tables are listed.get_tools()so it is available to agents and tool discovery.Why?
Tests
tests/test_database_tool.pywith tests for both all-tables and single-table schema fetches using a sample SQLite database.Example Usage