@@ -23,6 +23,7 @@ import {
2323 listOrganizationsInputSchema ,
2424 listSharedProjectsInputSchema ,
2525 resetFromParentInputSchema ,
26+ compareDatabaseSchemaInputSchema ,
2627} from './toolsSchema.js' ;
2728
2829export const NEON_TOOLS = [
@@ -608,4 +609,66 @@ export const NEON_TOOLS = [
608609 description : 'Lists compute endpoints for a project or specific branch' ,
609610 inputSchema : listBranchComputesInputSchema ,
610611 } ,
612+ {
613+ name : 'compare_database_schema' as const ,
614+ description : `
615+ <use_case>
616+ Use this tool to compare the schema of a database between two branches.
617+ The output of the tool is a JSON object with one field: \`diff\`.
618+ At this field you will find a difference between two schemas.
619+
620+ You MUST BE READY to generate a zero-downtime migration from the diff and apply it to the parent branch.
621+ </use_case>
622+
623+ <important_notes>
624+ To generate schema diff, you MUST SPECIFY the \`database_name\`.
625+ If it's not specified, try to use the default database name: \`${ NEON_DEFAULT_DATABASE_NAME } \`.
626+
627+ You MUST TAKE INTO ACCOUNT the Postgres version. The Postgres version is the same for both branches.
628+ You MUST ASK user consent before running each generated SQL query.
629+ You SHOULD USE \`run_sql\` tool to run each generated SQL query.
630+ Generated queries change the schema of the parent branch and MIGHT BE dangerous to execute.
631+ </important_notes>
632+
633+ <next_steps>
634+ After executing this tool, you MUST follow these steps:
635+ 1. Review the schema diff and suggest to generate a zero-downtime migration.
636+ 2. Follow these instructions to respond to the client:
637+
638+ <response_instructions>
639+ <instructions>
640+ Provide a brief information about the changes:
641+ * Tables
642+ * Views
643+ * Indexes
644+ * Ownership
645+ * Constraints
646+ * Triggers
647+ * Policies
648+ * Extensions
649+ * Schemas
650+ * Sequences
651+ * Tablespaces
652+ * Users
653+ * Roles
654+ * Privileges
655+ </instructions>
656+ </response_instructions>
657+ </next_steps>
658+
659+ This tool:
660+ 1. Generates a diff between two branches.
661+ 2. Generates a SQL migration from the diff.
662+ 3. Suggest to generate zero-downtime migration.
663+
664+ Workflow:
665+ 1. User asks you to generate a diff between two branches.
666+ 2. You suggest to generate a SQL migration from the diff.
667+ 3. You ensure that the generated migration is a zero-downtime migration,
668+ otherwise you should warn the user about it.
669+ 4. You ensure that your suggested migration is also matching the Postgres version.
670+ 5. You use \`run_sql\` tool to run each generated SQL query and ask the user consent before running it.
671+ ` ,
672+ inputSchema : compareDatabaseSchemaInputSchema ,
673+ } ,
611674] ;
0 commit comments