Do AI Agents Need a Semantic Layer?Livestream August 26

Skip to main content

MD_CREATE_GUIDE

Preview
This feature is in preview and is subject to change.

Create a new Guide, identified by a generated UUID. Returns the created Guide's metadata and initial version information.

Syntax

SELECT * FROM MD_CREATE_GUIDE(
topic = 'revenue-billing',
title = 'MRR and ARR Definitions',
content = '# MRR and ARR Definitions ...',
description = 'How MRR and ARR are calculated',
access = 'organization'
);

Parameters

ParameterTypeRequiredDescription
titleVARCHARYesHuman-readable title. Must not be empty.
contentVARCHARYesFull markdown body of the Guide. Maximum 1 MB.
topicVARCHARNoSlash-separated grouping label — for example 'revenue-billing' or 'core/metrics'. No leading or trailing slash. Omit for no topic.
descriptionVARCHARNoShort one-line summary shown in MD_LIST_GUIDES.
accessVARCHARNo'user' (private, default) or 'organization' (org-wide, admin-permission gated).
change_commentVARCHARNoNote describing this initial version.
external_idVARCHARNoCaller-provided ID for this version (for example a git SHA).
"references"STRUCT[]NoStructured references to the objects this Guide explains. See reference struct.

Topics are grouping labels only — they carry no uniqueness, so multiple Guides can share the same topic.

Return columns

ColumnTypeDescription
idUUIDGenerated identifier of the created Guide
topicVARCHARGrouping label (NULL if omitted)
titleVARCHARGuide title
descriptionVARCHAROne-line summary
owner_idUUIDUUID of the Guide owner
owner_nameVARCHARName of the Guide owner
accessVARCHAR'user' or 'organization'
current_versionUINTEGERVersion number (1 for newly created Guides)
created_atTIMESTAMP WITH TIME ZONEWhen the Guide was created
updated_atTIMESTAMP WITH TIME ZONEWhen the Guide was last updated
version_change_commentVARCHARNote for the initial version
version_external_idVARCHARCaller-provided version ID
version_created_atTIMESTAMP WITH TIME ZONEWhen the initial version was created
referencesSTRUCT[]Resolved references

Examples

Create an org-wide metric definition Guide:

SELECT id, topic, current_version
FROM MD_CREATE_GUIDE(
topic = 'revenue-billing',
title = 'MRR and ARR Definitions',
description = 'How monthly and annual recurring revenue are calculated',
content = '# MRR and ARR Definitions

MRR is the sum of all active subscription amounts normalized to a monthly value.

Key rules:
- Use the subscriptions table, not invoices
- Filter to status = active
- Exclude trial subscriptions (trial_end IS NULL)',
access = 'organization',
change_comment = 'Initial version'
);

Create a private Guide without a topic:

SELECT id, title
FROM MD_CREATE_GUIDE(
title = 'My scratch notes',
content = 'Always double-check the currency column.'
);