SQL · template

Give your agent your SQL Server schema, without a login

One file in. Tables, types and foreign keys that an assistant can use.

Import a SQL Server schema file. Then your assistant knows the tables, types and foreign keys, can say what a change touches, and can write GraphQL, Protobuf, Avro or JSON Schema types.

What you get

Your assistant gets the tables, columns, types and foreign keys of a SQL Server database from one file. It can then tell you which tables a change touches, and write typed code for them. It never gets a login and never sees a row.

What we didWhat CoreModels answeredTime
Imported the schema file16 tables, 89 columns5 s
Asked what points to the table film3 tables: film_actor, film_category, inventory1 s
Asked for GraphQL types of film2 types with required fields1 s

Recorded on 4 December 2026 with the Sakila sample database for SQL Server, a film rental shop kept by the jOOQ team (repository). Licence: BSD. We also read two tables in the form that Management Studio writes, with names and types in brackets. Both came in with their types.

What you need

  • A CoreModels account with one project. Every plan starts with a 14-day free trial; a card is required to start.
  • An assistant that can use MCP servers, for example Claude Code or Cursor.
  • No SQL Server login. CoreModels reads a file with CREATE TABLE statements.

Run it

1. Connect your assistant

In Claude Code, run this command. Then sign in when it asks. This address can write to your projects, because an import creates a model.

claude mcp add --transport http coremodels https://go.coremodels.io/mcp-admin

Cursor, Claude Desktop and other clients: connect guide.

2. Import the schema

The example is a public file, so you can run it as it is.

Create a CoreModels project named "SQL Server example". Then call import_schema on it with format "sql" and this customFileUrl:
https://raw.githubusercontent.com/jOOQ/sakila/b3469a971dbf5b22eaa9163dca16bbafc90c6710/sql-server-sakila-db/sql-server-sakila-schema.sql

Your assistant calls create_project, then import_schema. The answer we got:

import_schema (part of the answer)

{
  "succeeded": true,
  "format": "sql",
  "decoded": {
    "types": 16,
    "elements": 89,
    "taxonomies": 0,
    "listItems": 0
  },
  "written": {
    "types": 16,
    "elements": 89,
    "taxonomies": 0,
    "listItems": 0
  }
}

decoded is what the file has. written is what is in your project now. The two are equal, so nothing was lost between them. The full answer also lists what the model does not hold, for example indexes and default values.

3. Ask before you change a table

A foreign key points from another table to this one. In a large database that is easy to miss.

Call analyze_concept_impact for "film" in this project. Which tables point to it, and with which column?

Your assistant calls analyze_concept_impact. The answer we got:

analyze_concept_impact (part of the answer)

{
  "label": "film",
  "kind": "Type",
  "governedUsage": [
    {
      "kind": "referencedByElement",
      "description": "Referenced by element 'film_id' on type 'film_category'."
    },
    {
      "kind": "referencedByElement",
      "description": "Referenced by element 'film_id' on type 'film_actor'."
    },
    {
      "kind": "referencedByElement",
      "description": "Referenced by element 'film_id' on type 'inventory'."
    }
  ]
}

This call only reads. The full answer also lists the columns of the table.

4. Get types for your code

The model writes other formats from the same tables. This is GraphQL.

Call export_schema with format "graphql" for the type film only.

Your assistant calls export_schema. The answer we got:

export_schema (the content)

scalar DateTime

type film {
  replacement_cost: Float!
  title: String!
  rental_rate: Float!
  length: Int
  original_language_id: language
  release_year: String
  last_update: DateTime!
  film_id: Int!
  rental_duration: Int!
  rating: String
  description: String
  language_id: language!
  special_features: String
}

type language {
  language_id: Int!
  name: String!
  last_update: DateTime!
}

Other formats are JSON Schema, Protobuf, Avro, LinkML, OWL and a data contract (ODCS).

Now with your own project

In SQL Server Management Studio, open the menu of the database, then Tasks, Generate Scripts, and save the tables to one file. Leave the data type of the script at "Schema only". Then give your assistant the prompt.

Create a CoreModels project for our database. Import schema.sql with import_schema, format "sql". Show me decoded and written, and the list of what was not kept. Then tell me which tables point to YOUR_TABLE.

What it does not do

  • Indexes, default values, triggers, views and functions are not kept. The answer names each one.
  • The length of a text column and the mark for a primary key are named in the answer and not kept in the model.
  • Your assistant sends your own file as text. With a very large schema, send the tables you need. In Generate Scripts you can select only the tables you need.
  • The pass or fail check of our connectors does not cover a SQL file. After a change, import the new file again.
  • CoreModels does not connect to your SQL Server server.

← Back to SQL

Start building

14-day free trial. Builder $49/mo after the trial. Cancel any time.