Skip to content

Conversation

@mattrossman
Copy link
Contributor

@mattrossman mattrossman commented Oct 23, 2025

Updates server to only fetch the GraphQL schema for search_docs description once per session, even for stateless transports.

Changes

  • validateSchema now defaults to false, disabling local schema validation in favor of server-side validation with comparable error reporting verified in feat: lazy graphql schema #166 (comment)
  • Tool description changed from string to Prop<string> allowing sync/async callbacks to lazily construct descriptions as-needed during "tools/list" requests
  • New test "schema is only loaded when listing tools" checks that the (mocked) schema loading only occurs when listing tools and not on tool calls

Resolves AI-179

${contentApiClient.schema}
`,
return source`
Search the Supabase documentation using GraphQL. Must be a valid GraphQL query.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with this PR but I've noticed that this tool is only called when I start my prompts with "How can I... or How do I..." (at least for me). Sometimes, if it bumps into any problem while calling other tool, the LLM will search for the docs online instead of calling this tool.

If anyone else is experiencing this, my suggestion is:

  1. We write explicitly in the tool description "If you face any issue while calling other Supabase tool, use the search_docs tool to get the most up-to-date documentation to help you debug"
  2. We put this disclaimer on every tool description

I prefer the first one because we only have to maintain this instruction once.

PS: I would only change this behavior once we have evals in place

@mattrossman
Copy link
Contributor Author

Looks like the error handling is basically the same with validateSchema: false, letting the GraphQL server handle validation. The message prefix is slightly different but it also adds more info about the error location(s) which is nice.

before after
CleanShot 2025-10-24 at 14 11 40@2x CleanShot 2025-10-24 at 14 12 05@2x

@mattrossman mattrossman marked this pull request as ready for review October 24, 2025 19:06
Copy link
Contributor

@Rodriguespn Rodriguespn left a comment

Choose a reason for hiding this comment

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

LGTM

I have not much to add to this PR besides the comment about the docs tool description, which we should address (or at least discuss) on a different PR.

Ship it 🚀

@mattrossman
Copy link
Contributor Author

Added a link to your comment on our ticket for eval test cases, will revisit the invocation behavior as part of that 👍

@mattrossman mattrossman merged commit d9d9f0e into main Oct 27, 2025
2 checks passed
Rodriguespn pushed a commit that referenced this pull request Oct 30, 2025
* feat: support lazy tool definitions, disable client schema validation by
default

* feat: lazy tool descriptions

* chore: cleanup logs

* docs: restore comment

* feat: revert lazy tool definitions, just use lazy description

* chore: cleanup

* chore: unused imports

* test: schema is only loaded when listing tools
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.

3 participants