Skip to main content

Schema Inspection

VEF includes a schema inspection service and a built-in resource for reading database structure through the application API.

Module Outputs

The schema module provides:

OutputMeaning
schema.Serviceschema inspection service
sys/schemabuilt-in RPC resource

schema.Service Interface

The public schema service exposes:

MethodReturn typePurpose
ListTables(ctx)[]schema.Tablelist tables in the current schema or database
GetTableSchema(ctx, name)*schema.TableSchemainspect one table in detail
ListViews(ctx)[]schema.Viewlist views
ListTriggers(ctx)[]schema.Triggerlist triggers

Built-In Resource

The schema module registers:

Resource
sys/schema

Current actions:

ActionInput paramsOutput typeNotes
list_tablesnone[]schema.Tablelist current tables
get_table_schemaname: stringschema.TableSchemareturns a dedicated schema-table-not-found business error when the table does not exist
list_viewsnone[]schema.Viewlist current views
list_triggersnone[]schema.Triggerlist current triggers

Implementation details visible in source:

  • each action currently sets a per-operation rate-limit max of 60
  • get_table_schema validates that name is present
  • missing tables are mapped to result.ErrCodeSchemaTableNotFound

Public Schema Types

schema.Table

FieldTypeMeaning
namestringtable name
schemastringschema name when available
commentstringtable comment

schema.TableSchema

FieldTypeMeaning
namestringtable name
schemastringschema name
commentstringtable comment
columns[]schema.Columnall columns
primaryKey*schema.PrimaryKeyprimary key definition
indexes[]schema.Indexnon-unique indexes
uniqueKeys[]schema.UniqueKeyunique constraints
foreignKeys[]schema.ForeignKeyforeign key constraints
checks[]schema.Checkcheck constraints

schema.Column

FieldTypeMeaning
namestringcolumn name
typestringraw database type
nullableboolwhether the column is nullable
defaultstringdefault expression
commentstringcolumn comment
isPrimaryKeyboolwhether the column participates in the primary key
isAutoIncrementboolwhether the column is auto-incrementing

schema.PrimaryKey

FieldTypeMeaning
namestringprimary key name
columns[]stringprimary key columns

schema.Index

FieldTypeMeaning
namestringindex name
columns[]stringindexed columns

schema.UniqueKey

FieldTypeMeaning
namestringunique key name
columns[]stringunique columns

schema.ForeignKey

FieldTypeMeaning
namestringforeign key name
columns[]stringlocal columns
refTablestringreferenced table
refColumns[]stringreferenced columns
onUpdatestringupdate action
onDeletestringdelete action

schema.Check

FieldTypeMeaning
namestringcheck constraint name
exprstringcheck expression

schema.View

FieldTypeMeaning
namestringview name
schemastringschema name
definitionstringview definition SQL
commentstringview comment
columns[]stringprojected columns
materializedboolwhether the view is materialized

schema.Trigger

FieldTypeMeaning
namestringtrigger name
tablestringtarget table when applicable
viewstringtarget view when applicable
actionTimestringbefore/after/instead-of timing
events[]stringtrigger events such as insert or update
forEachRowboolrow-level or statement-level trigger
bodystringtrigger body definition

Minimal Request Example

{
"resource": "sys/schema",
"action": "get_table_schema",
"version": "v1",
"params": {
"name": "sys_user"
}
}

Intended Use

This feature is useful for:

  • admin tooling
  • internal developer tooling
  • schema-aware integrations
  • MCP or prompt workflows that need database metadata

Next Step

Read Built-in Resources to see how sys/schema relates to the other framework-provided RPC resources.