list_relationships
Retrieve relationships for an entity or discover the type between two entities. Filter by source, target, direction, or relationship type with pagination support.
Instructions
List relationships for an entity, or discover the relationship type(s) between two specific entities. Filter by entity_id (with direction), or by source_entity_id and/or target_entity_id, and optionally relationship_type. To discover the type before delete_relationship, pass both source_entity_id and target_entity_id: each returned relationship carries its relationship_type. Soft-deleted relationships are excluded by default, so a deleted edge will not be re-offered for deletion; pass include_deleted: true to include them for audit. Paginated via limit/offset.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | No | Entity ID to match against either the source or target of each relationship (filtered further by `direction`). Legacy filter pattern; prefer `source_entity_id` / `target_entity_id` for new code. | |
| source_entity_id | No | Match relationships whose `source_entity_id` equals this value. | |
| target_entity_id | No | Match relationships whose `target_entity_id` equals this value. | |
| direction | No | Direction applied when `entity_id` is set. `incoming`/`inbound` matches relationships where the entity is the target; `outgoing`/`outbound` matches relationships where the entity is the source; `both` (default) matches either side. | both |
| relationship_type | No | Optional relationship_type filter. Closed enum matching the handler's accepted values; spec-driven clients passing any other value will be rejected at runtime with a Zod validation error. | |
| limit | No | Maximum number of relationships to return. | |
| offset | No | Number of relationships to skip before returning results. | |
| include_deleted | No | When `false` (default), soft-deleted relationships are excluded from the result. When `true`, soft-deleted edges are included (audit/history use). A relationship is soft-deleted once its highest-priority deletion observation is recorded; the snapshot row itself persists. | |
| user_id | No | Optional user_id override (scoped to callers with privilege to query on behalf of another user). When omitted, the authenticated user is used. |