Docs/Core Concepts/Schema Discovery
Core Concepts7 min read

Schema Discovery

How conexor.io reads your database structure and automatically generates a typed MCP tool for every query pattern.

What gets discovered

When you click Sync Schema, the agent queries your database's information schema. It collects:

  • Tables and views — names, schemas, and estimated row counts
  • Columns — names, data types, nullability, and default values
  • Primary keys — used to generate lookup-by-id tools
  • Foreign keys — used to infer relationships and join patterns
  • Indexes — used to suggest efficient filter columns
INFOSchema discovery only reads metadata — it never reads row data. Your actual records are never accessed during discovery.

How tools are generated

For each table, conexor.io generates a set of MCP tools based on the column types and index structure. A typical table produces 2–4 tools:

Example: users table

Schema: public.users
sql
CREATE TABLE users (
    id          UUID PRIMARY KEY,
    email       VARCHAR(255) UNIQUE NOT NULL,
    name        VARCHAR(100),
    created_at  TIMESTAMPTZ DEFAULT now(),
    org_id      UUID REFERENCES organizations(id)
);

Generated tools:

query_users

Filter users by any column combination. Returns paginated rows.

params: email?, name?, org_id?, limit?, offset?

query_users_by_id

Look up a single user by primary key.

params: id (required)

query_users_by_email

Look up a user by unique email.

params: email (required)

count_users

Count users matching optional filters.

params: org_id?, created_after?, created_before?

Relationship-aware tools

When foreign keys are detected, conexor.io generates join-aware tools that let Claude query across related tables without needing to issue multiple queries:

text
# FK: orders.user_id → users.id
# FK: orders.product_id → products.id

Generated:
  query_orders_with_user    — JOIN orders + users
  query_orders_with_product — JOIN orders + products
  query_user_orders         — Get all orders for a user_id
TIPRelationships are inferred from foreign key constraints. If your schema uses soft FK references without constraints, you can manually annotate relationships from the data source settings page.

Performance on large schemas

Discovery is optimised to run in a single batch against the information schema. For databases with 1000+ tables, the process typically takes 10–30 seconds. Tables are streamed back incrementally — you can see progress in the dashboard as it runs.

Excluding tables

You can exclude specific tables or schemas from discovery using patterns in the data source settings. This is useful for excluding internal audit tables, migration tables, or schemas you don't want AI models to query.

text
# Exclusion patterns (glob syntax)
migrations.*          # Exclude all tables in migrations schema
*_audit               # Exclude any table ending in _audit
internal.secrets      # Exclude a specific table

Keeping schema in sync

Schema discovery does not run continuously — it is triggered manually or via the API. If you add new tables or columns to your database, click Sync Schema again to update the MCP tools. The old tools are replaced atomically — there is no downtime during re-sync.

NOTEIf a column is renamed or removed after discovery, existing MCP tools that reference it will fail at query time. Re-sync after schema changes.

© 2026 conexor.io

All systems operational
Relay

Quick questions

Relay

Quick questions