-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor: Combine Rules Validation and Get Rules MCP Tools #9157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Combines the firestore_validate_rules, storage_validate_rules, and database_validate_rules MCP tools into a single validate_rules MCP tool in the core feature group. This new tool takes an additional required argument 'type', which can be either 'firestore', 'rtdb', or 'storage', and then triggers the appropriate behavior based on that.
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! I will automatically address your feedback. For any comments you don't want me to act on, just include (aside). For security, I will only act on instructions from the user who triggered this task for this pull request. |
src/mcp/tools/core/validate_rules.ts
Outdated
databaseUrl: z | ||
.string() | ||
.optional() | ||
.describe( | ||
"For RTDB, connect to the database at url. If omitted, use default database instance. Can point to emulator URL.", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this apply to Firestore and Storage as well (multiple DBs / multiple buckets)? I think we probably either make this a general resource_id
which is RTDB instance name, firestore database name, or bucket name, or we drop this altogether and do "defaults only" for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped this for now, as it is a bit unclear to me whether this even matters - ie can you even have a ruleset that is valid for one resource but invalid for another resource of the same type?
Also, ended up cleaning up a bunch of this logic in here to properly check the default RTDB instance, and make the behavior of rtdb more similar to firestore/storage.
src/mcp/tools/core/index.ts
Outdated
export const coreTools: ServerTool[] = [ | ||
login, | ||
logout, | ||
validate_rules, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting corner case for feature detection: we should only activate this tool if one of the three services that use it are active.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - I think I'm gonna handle this in a follow up PR tho. I'd like to build out a slightly more robust system for feature detection rather than have logic scattered across the codebase, and I think it makes sense to cover a bunch of tools at once.
I'll add a todo to keep track of this tho.
* feat(mcp): combine get_rules tools into a single core_get_rules tool Combines the firestore_get_rules, storage_get_rules, and database_get_rules tools into a single get_rules tool in the core tool group. This new tool takes an additional required argument 'type', which can be either 'firestore', 'rtdb', or 'storage', and then triggers the appropriate behavior based on that. It also adds a validation check to ensure that the `databaseUrl` argument is only provided when the type is 'rtdb'. * one last file * PR fixes * GCA suggestions * Formats --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Joe Hanley <joehanley@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rtdb part lgtm (did not pass over the other implementations). Thanks for making these changes. fyi this is probably going to conflict with @charlotteliang 's pr to rename the rules to rtdb from database, so this or that will have to be resolved
This change combines the
firestore_validate_rules
,storage_validate_rules
, anddatabase_validate_rules
MCP tools into a singlevalidate_rules
tool in thecore
feature group. This new tool takes atype
argument to specify which validation to run.PR created automatically by Jules for task 9425419525586992510