Validations (GraphQL)

Related queries and mutations in Monitors. Each has its own section.

Queries

evaluateDataSource (query)

evaluateDataSource is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Evaluates a data source

Arguments

ArgumentTypeDescription
dataSourceTypeDataSourceType!Data source type
connectionIdUUIDConnection UUID
dwIdUUIDWarehouse UUID
mconStringMCON to evaluate
sqlStringSQL to evaluate
transforms[TransformInput!]Transforms to apply to the data source

Returns

DataSourceEvaluationResult

Example

query EvaluateDataSource($dataSourceType: DataSourceType!) {
  evaluateDataSource(dataSourceType: $dataSourceType) {
    connectionUuid
    warehouseUuid
    mcons
    rowCount
    unresolvedMcons
    whereCondition
  }
}

Related types

DataSourceEvaluationResult, DataSourceType, TransformInput, UUID

evaluateSqlBlocks (query)

evaluateSqlBlocks is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Evaluates the provided SQL blocks

Arguments

ArgumentTypeDescription
connectionIdUUIDConnection UUID
dwIdUUIDWarehouse UUID
dataSourceDataSourceUnionInput!The data source
sqlBlocksCustomRuleSqlBlocksInput!The SQL blocks
countRowsBooleanWhether to count the number of rows returned by the SQL blocks Default: false.
validateCustomSqlBooleanWhether to validate the custom and generated SQL by running it against the data warehouse Default: true.
resolveTransformQueriesBooleanreturn a query for each transform in the data source. Default: false.

Returns

SqlBlockEvaluationResult

Example

query EvaluateSqlBlocks($dataSource: DataSourceUnionInput!, $sqlBlocks: CustomRuleSqlBlocksInput!) {
  evaluateSqlBlocks(dataSource: $dataSource, sqlBlocks: $sqlBlocks) {
    sql
    rowCount
    dataSourceSql
    fragments
    transformQueries
  }
}

Types used only by evaluateSqlBlocks

SqlBlockEvaluationResult

Object type.

FieldTypeDescription
errors[Error!]!
sqlString
rowCountInt
dataSourceSqlString
fragmentsGenericScalar
transformQueries[String!]

Related types

CustomRuleSqlBlocksInput, DataSourceUnionInput, Error, GenericScalar, UUID

generateMcSql (query)

generateMcSql is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Returns a presentable format of alert conditions

Arguments

ArgumentTypeDescription
connectionIdUUIDConnection UUID
dwIdUUIDWarehouse UUID
dataSourceDataSourceUnionInput!The data source
sqlBlocksCustomRuleSqlBlocksInput!The SQL blocks

Returns

McSqlResult

Example

query GenerateMcSql($dataSource: DataSourceUnionInput!, $sqlBlocks: CustomRuleSqlBlocksInput!) {
  generateMcSql(dataSource: $dataSource, sqlBlocks: $sqlBlocks) {
    sql
    fragments
  }
}

Types used only by generateMcSql

McSqlResult

Object type.

FieldTypeDescription
errors[Error!]!
sqlString
fragmentsGenericScalar

Related types

CustomRuleSqlBlocksInput, DataSourceUnionInput, Error, GenericScalar, UUID

getSpanPredicates (query)

getSpanPredicates is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Gets all available span predicates for agent trajectory monitors

Returns

[SpanPredicate!]

Example

query GetSpanPredicates {
  getSpanPredicates {
    name
    description
    arity
    allowManyRight
    allowNegation
    negatedDescription
    category
    hint
    allowedComparisonOperators
    supportedConnections
  }
}

Types used only by getSpanPredicates

SpanPredicate

Object type.

FieldTypeDescription
nameString!
descriptionString!
aritySpanPredicateArity!
allowManyRightBoolean!
allowNegationBoolean!
negatedDescriptionString
categoryString
hintString
allowedComparisonOperators[FilterSpanComparisonOperator!]
minimumCounts[SpanPredicateMinimumCount!]
supportedConnections[String!]!
SpanPredicateArity

Enum type. Arity types for span predicates.

ValueDescription
SPAN_OCCURRENCE
SPAN_RELATION
SpanPredicateMinimumCount

Object type.

FieldTypeDescription
operatorFilterSpanComparisonOperator!
countInt!

Related types

FilterSpanComparisonOperator

getSqlPredicates (query)

getSqlPredicates is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Returns

[Predicate]

Example

query GetSqlPredicates {
  getSqlPredicates {
    name
    description
    sql
    arity
    supportedTypes
    requiredType
    allowManyLeft
    allowManyRight
    usedInLiteralRight
    usedInLiteralLeft
    allowNegation
    negatedDescription
    negatedSql
    category
    supportedConnections
    mcSqlSupported
    pythonEval
    rightRequiredType
  }
}

Types used only by getSqlPredicates

Override

Object type.

FieldTypeDescription
dialectSqlDialect!
sqlString!
negatedSqlString
Predicate

Object type.

FieldTypeDescription
nameString!
descriptionString!
sqlString!
arityPredicateArity!
overrides[Override!]!
supportedTypes[FieldType!]!
requiredTypePredicateRequiredType!
allowManyLeftBoolean!
allowManyRightBoolean!
usedInLiteralRightBoolean!
usedInLiteralLeftBoolean!
allowNegationBoolean!
negatedDescriptionString
negatedSqlString
categoryString
supportedConnections[String!]!
mcSqlSupportedBoolean!
pythonEvalString
rightRequiredTypePredicateRequiredType
PredicateArity

Enum type.

ValueDescription
BINARY
UNARY
SqlDialect

Enum type.

ValueDescription
BIGQUERY
REDSHIFT
SNOWFLAKE
HIVE
PRESTO
SPARK
ATHENA
DATABRICKS
POSTGRES
SQL_SERVER
TSQL
TERADATA
ORACLE
MYSQL
MARIADB
SAPHANA
MOTHERDUCK
DB2
DREMIO
SALESFORCE_CRM
SALESFORCE_DATA_CLOUD
CLICKHOUSE
STARBURST_GALAXY
STARBURST_ENTERPRISE
CUSTOM_CONNECTOR
UNKNOWN

Related types

FieldType, PredicateRequiredType

getTransformFunctions (query)

getTransformFunctions is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Gets all available transform functions

Arguments

ArgumentTypeDescription
includeConversationFunctionsBooleanWhen true, returns conversation-level LLM-as-judge templates (conversation: true) in addition to single-turn warehouse-executable transforms. Default returns only single-turn transforms so warehouse-facing callers are unaffected. Default: false.

Returns

[TransformFunction!]

Example

query GetTransformFunctions {
  getTransformFunctions {
    name
    title
    description
    sql
    supportedTypes
    requiredType
    supportedConnections
    category
    prompt
    scoreField
    outputType
    outputDescription
    supportsFieldRange
    usesResponseFormat
    supportedOutputTypes
    icon
    sqlExpressionMap
    rubric
    biasGuardrail
    returns
  }
}

Types used only by getTransformFunctions

TransformFunction

Object type.

FieldTypeDescription
nameString!
titleString!
descriptionString!
sqlString!
supportedTypes[FieldType!]!
requiredTypePredicateRequiredType!
supportedConnections[String!]!
categoryString
promptString
scoreFieldString
outputTypeString
outputDescriptionString
supportsFieldRangeBoolean!
usesResponseFormatBoolean!
supportedOutputTypes[String!]!
iconString
sqlExpressionMapGenericScalar
rubric[String!]
scoringAnchors[TransformScoringAnchor!]
biasGuardrailString
returnsString
customizeString
conversationBoolean!
includeToolCallsDefaultBoolean!
TransformScoringAnchor

Object type.

FieldTypeDescription
scoreString!
descriptionString!

Related types

FieldType, GenericScalar, PredicateRequiredType

getWarehouseSupportedLlmModels (query)

getWarehouseSupportedLlmModels is a query in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Gets all available LLM models across warehouse types

Arguments

ArgumentTypeDescription
warehouseUuidUUIDWarehouse UUID. If provided, the connection type will be ignored.
connectionTypeStringconnection type, for example "snowflake", "bigquery", etc.

Returns

[LLMModel!]

Example

query GetWarehouseSupportedLlmModels {
  getWarehouseSupportedLlmModels {
    name
    description
    warehouseType
    category
    contextWindow
    regions
    default
    requiresCrossRegionInference
  }
}

Types used only by getWarehouseSupportedLlmModels

LLMModel

Object type.

FieldTypeDescription
nameString!
descriptionString!
warehouseTypeString!
categoryString!
contextWindowInt!
regionsGenericScalar
defaultBoolean!
requiresCrossRegionInferenceBoolean!

Related types

GenericScalar, UUID

Mutations

createOrUpdateValidation (mutation)

createOrUpdateValidation is a mutation in the Monte Carlo GraphQL API, in Monitors. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Create or update a validation

Arguments

ArgumentTypeDescription
alertConditionFilterGroupInput!
alertGroupingAlertGroupingInputPer-monitor alert grouping configuration. Omit or pass null for legacy per-type grouping; a non-null value enables monitor-based alert grouping. The createOrUpdate* mutations are full-state: omitting this field on an update clears any existing configuration (same as samplingConfig).
audienceConditions[AudienceConditionInput!]Narrows individual audiences to the triage priorities that reach them. Always a full replace: omitting the argument (or passing null) makes every audience unconditional, the same as passing an empty list; a non-empty list replaces the conditions wholesale. Every audience named here must also appear in this mutation's audience list (audiences, or labels on the mutations that spell it that way), which stays the monitor's full audience set — a condition narrows when one of them is notified, it does not add one.
autoTriageBooleanPer-monitor automated-triage override. true forces triage on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
autoTuningBooleanPer-monitor auto-apply-tuning override. true forces auto-apply tuning on for this monitor, false forces it off, and null (or omitting the argument) clears the override so the monitor inherits the domain/account setting. Because omitting the argument clears the override, an update call that does not send this field will reset any previously set override, including a deliberate false, back to inherit.
connectionIdUUIDSpecify a connection (e.g. query-engine) to use
customRuleUuidUUIDUUID of custom rule, to update existing rule
dataQualityDimensionStringData quality dimension on the custom rule.
dataSourceDataSourceUnionInput!
descriptionString!Description of rule
domainUuids[UUID!]Please provide one and only one valid domain uuid.
dryRunBooleanDry run the monitor creation or update and return the MaC YAML and queries. Default: false.
dwIdUUID!Warehouse UUID
eventRollupCountIntThe number of events to roll up into a single incident
eventRollupUntilChangedBooleanIf true, roll up events until the value changes
exceptionPrimaryKeyColumnStringSpecifies the column which contains the primary key for sampled data used in exception management.
failOnResetBooleanReturn an error if the update is a significant change that would reset the monitor (e.g. switching threshold type). Lets the UI warn before resetting. Default: false.
failureAudiences[String!]The audiences to notify on failure
intervalMinutesIntHow often to run scheduled custom rule check (DEPRECATED, use schedule instead)
isDraftBooleanMake target a draft monitor. Default: false.
labels[String]The monitor labels
notesStringAdditional context for the monitor Default: "".
notifyRuleRunFailureBooleanDEPRECATED: Completely ignored. This field has no effect on anything. Use failure_audiences to determine who is notified when run failures occur.
percentageOperatorValidationPercentageThresholdOperatorComparison operator for validation percentage thresholds. Defaults to GT when percentage_threshold is set without an operator.
percentageThresholdFloatPercentage threshold to alert on as a percentage of total rows.
priorityStringThe default priority for alerts involving this monitor
scheduleConfigScheduleConfigInput!Schedule of the validation
severityStringDEPRECATED. Use priority instead. The default severity for incidents involving this monitor Default: "".
startTimeDateTimeStart time of schedule (DEPRECATED, use schedule instead)
tags[TagKeyValuePairInput]The monitor tags.
timeFilterValidationTimeFilterInputOptional rolling time-window filter scoping the validation query at every run. Omitted on update clears any previously saved filter.
timeoutIntTimeout for the SQL query
timezoneStringTimezone (DEPRECATED, use timezone in scheduleConfig instead

Returns

CreateOrUpdateValidation

Example

mutation CreateOrUpdateValidation($alertCondition: FilterGroupInput!, $dataSource: DataSourceUnionInput!, $description: String!, $dwId: UUID!, $scheduleConfig: ScheduleConfigInput!) {
  createOrUpdateValidation(alertCondition: $alertCondition, dataSource: $dataSource, description: $description, dwId: $dwId, scheduleConfig: $scheduleConfig) {
    yaml
    queries
    persistBlockedBy
    spendGuardrailMessage
  }
}

Types used only by createOrUpdateValidation

CreateOrUpdateValidation

Object type. Create or update a validation

FieldTypeDescription
validationCustomRule
yamlString
queries[String!]SQL queries that will be run by the monitor on each execution.
estimatedCreditsEstimatedCreditsSpec-derived daily credit estimate. Computed from the provided input config, not from persisted DB state — so dry-run, draft, and full create/update all return a consistent preview. Only populated for accounts on the per-monitor credit consumption pricing model; null otherwise.
persistBlockedByStringSet on dry runs only. Says why saving this monitor would not give the result the preview shows. A permission path, such as monitors/management/metric/edit, means the caller lacks it and the save would be refused. The caller can still save the monitor as a draft if it has the monitor type's draft permission. SPEND_GUARDRAIL means a spend guardrail is reached, so the save would create this new monitor as a draft instead of live. spendGuardrailMessage names the guardrail. When both apply, the permission path is returned. Null when the save would go through as previewed, and on requests that are not dry runs.
spendGuardrailMessageStringSet when a reached spend guardrail makes the save create this new monitor as a draft instead of live: on a dry run, when the save would do so, and on the save itself, when it did. A sentence for the user that names the guardrail (the account's or a domain's), its amount and when it resets, and says that an Account Owner can raise it. On a dry run whose persistBlockedBy is a permission path, the save is refused instead, so read that first. Null otherwise, including for a monitor saved as a draft on request, and for updates to an existing monitor.
ValidationPercentageThresholdOperator

Enum type.

ValueDescription
GT
GTE
EQ
LT
LTE
ValidationRollingWindowHoursInput

Input object type. Rolling-window time filter for validation monitors with a custom length. Combines a date/timestamp column with a number of hours evaluated relative to the run time.

FieldTypeDescription
timeFieldFilterValueFieldInput!The date/timestamp column the rolling window filters on.
lookbackInHrsInt!Rolling-window length in hours, evaluated relative to each run's start time. Must be at least 1.
ValidationRollingWindowInput

Input object type. Structured rolling-window time filter for validation monitors. Combines a date/timestamp column with one of a fixed set of rolling periods evaluated relative to the run time.

FieldTypeDescription
timeFieldFilterValueFieldInput!The date/timestamp column the rolling window filters on.
periodValidationTimeWindowPeriod!Rolling-window length, evaluated relative to each run's start time.
ValidationTimeFilterInput

Input object type. Optional time-window filter applied to a form-mode validation monitor. Exactly one of rollingWindow (column + period), rollingWindowHours (column + number of hours) or sqlExpression (free-form SQL fragment) must be set. Omit the argument entirely to clear any previously-saved filter.

FieldTypeDescription
rollingWindowValidationRollingWindowInputStructured filter: a date/timestamp column plus a rolling window. Mutually exclusive with rollingWindowHours and sqlExpression.
rollingWindowHoursValidationRollingWindowHoursInputStructured filter: a date/timestamp column plus a rolling window of any number of hours. Mutually exclusive with rollingWindow and sqlExpression.
sqlExpressionStringFree-form SQL fragment used as the WHERE clause for the time filter. The fragment is rendered verbatim into the executed query. Mutually exclusive with rollingWindow and rollingWindowHours. Must be a boolean WHERE-clause expression — expressions beginning with SELECT (case-insensitive, ignoring leading whitespace and zero-width characters) are rejected.
ValidationTimeWindowPeriod

Enum type. Rolling-window period for a validation monitor's time filter. Each value maps to a fixed number of hours evaluated relative to run start time:

  • PAST_HOUR = 1 hour
  • PAST_1_DAY = 24 hours
  • PAST_2_DAYS = 48 hours
  • PAST_3_DAYS = 72 hours
  • PAST_5_DAYS = 120 hours
  • PAST_1_WEEK = 168 hours
  • PAST_2_WEEKS = 336 hours
  • PAST_3_WEEKS = 504 hours
  • PAST_4_WEEKS = 672 hours
ValueDescription
PAST_HOUR
PAST_1_DAY
PAST_2_DAYS
PAST_3_DAYS
PAST_5_DAYS
PAST_1_WEEK
PAST_2_WEEKS
PAST_3_WEEKS
PAST_4_WEEKS

Related types

AlertGroupingInput, AudienceConditionInput, CustomRule, DataSourceUnionInput, DateTime, EstimatedCredits, FilterGroupInput, FilterValueFieldInput, ScheduleConfigInput, TagKeyValuePairInput, UUID

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.