get_foreign_keys
Retrieve foreign key relationships for a table, including both outgoing dependencies and incoming references, with optional filtering by direction or related table.
Instructions
Return foreign key relationships involving a table, in one or both directions. Returns [{direction, from_table, from_column, to_table, to_column, on_update, on_delete}]. Prefer inspect_table to get FKs alongside column and index information in one call. direction='out': what other tables this table depends on. direction='in': what other tables reference this table.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Database key from list_databases. | |
| table | Yes | Table name. Automatically uppercased. | |
| direction | No | 'out' = FKs declared on this table, 'in' = FKs on other tables pointing here, 'all' (default) = both. | all |
| relatedTable | No | Optional case-insensitive .NET regex to filter by the other table name. Filters to_table for direction='out', from_table for direction='in'. |