Zum Inhalt springen

Validation Rules

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Normative language (MUST/SHOULD/MAY) follows the conventions defined in Conformance Language.

This document defines all validation rules enforced by flowmcp validate. Each rule has a code, severity, and description.

This file is the central code registry for FlowMCP v4.2.0. All validation, selection, agent, skill, resource, and placeholder codes (VAL/SEL/AGT/SKL/RES/DEP/SEC/LST/PRM/CAT/ID/PH/TST) are defined here. Other specification documents and downstream tooling reference this registry but do not redefine codes.


SeverityDescriptionEffect
errorMust fix before useSchema cannot be loaded
warningShould fixSchema loads with warnings
infoNice to haveInformational only

CodeSeverityRule
VAL001errorSchema MUST export main as named export
VAL002errormain must be an object
VAL003errormain MUST NOT contain unknown fields
VAL004errorhandlers (if exported) must be a function
VAL005warninghandlers function MUST return an object with keys matching tool names

CodeSeverityRule
VAL010errormain.namespace is required and MUST be a string
VAL011errormain.namespace must match ^[a-z][a-z0-9-]*$
VAL012errormain.name is required and MUST be a string
VAL013errormain.description is required and MUST be a string
VAL014errormain.version is required and MUST match ^4\.\d+\.\d+$ (version ^3\.\d+\.\d+$ accepted with deprecation warning)
VAL015errormain.root is required when main.tools is non-empty. Optional for resource-only or skill-only schemas.
VAL016errormain.tools (or deprecated main.routes) must be an object. May be empty {} if main.resources is defined. main.skills is forbidden in v4.0.0 — skills are namespace-, selection-, or agent-scoped (see 14-skills).
VAL017errorSchema MUST NOT define both main.tools and main.routes simultaneously
VAL018warningmain.routes is deprecated. Use main.tools instead.

CodeSeverityRule
VAL020errormain.docs (if present) must be an array of strings
VAL021errormain.tags (if present) must be an array of strings
VAL022errormain.requiredServerParams (if present) must be an array of strings
VAL023errormain.headers (if present) must be a plain object
VAL024errormain.sharedLists (if present) must be an array of objects
VAL025errormain.requiredLibraries (if present) must be an array of strings
VAL026errorEach entry in requiredLibraries must be on the runtime allowlist

CodeSeverityRule
VAL030errorTool name MUST match ^[a-z][a-zA-Z0-9]*$
VAL031errorMaximum 8 tools per schema
VAL032errortool.method is required and MUST be GET, POST, PUT, or DELETE
VAL033errortool.path is required and MUST be a string starting with /
VAL034errortool.description is required and MUST be a string
VAL035errortool.parameters is required and MUST be an array
VAL036warningtool.output is recommended for new schemas
VAL037infotool.async is a reserved field (not executed in v3.0.0)

CodeSeverityRule
VAL040errorEach parameter MUST have position and z objects
VAL041errorposition.key is required and MUST be a string
VAL042errorposition.value is required and MUST be a string
VAL043errorposition.location must be insert, query, or body
VAL044errorz.primitive is required and MUST be a valid primitive type
VAL045errorz.options must be an array of strings
VAL046errorenum() values MUST NOT be empty
VAL047errorShared list interpolation {{listName:fieldName}} is only allowed in enum()
VAL048errorReferenced shared list MUST be declared in main.sharedLists
VAL049errorReferenced field MUST exist in the shared list’s meta.fields
VAL050errorinsert parameters MUST have a corresponding {{key}} in route.path

CodeSeverityRule
VAL060erroroutput.mimeType must be a supported MIME-Type
VAL061erroroutput.schema must be a valid schema definition
VAL062erroroutput.schema.type must match MIME-Type expectations
VAL063warningNested depth SHOULD NOT exceed 4 levels
VAL064errorproperties is only valid when type is object
VAL065erroritems is only valid when type is array

CodeSeverityRule
VAL070errorsharedLists[].ref is required and MUST be a string
VAL071errorsharedLists[].version is required and MUST be semver
VAL072errorReferenced list MUST exist in the list registry
VAL073errorReferenced list version MUST match or be compatible
VAL074errorfilter (if present) must have valid key field
VAL075warningUnused shared list reference (not used by any parameter or handler)

CodeSeverityRule
RES001errorsource must be one of 'sqlite', 'markdown', or 'http'. Other values are not accepted. See 13-resources.md for the semantics of each source type.
RES002errordescription must be a non-empty string.
RES003errordatabase must be a relative path ending with .db.
RES004errordatabase path MUST NOT contain .. segments.
RES005errorMaximum 2 resources per schema.
RES006errorMaximum 4 queries per resource.
RES007errorEach query MUST have a sql field of type string.
RES008errorEach query MUST have a description field of type string.
RES009errorEach query MUST have a parameters array.
RES010errorEach query MUST have an output object with mimeType and schema.
RES011errorEach query MUST have at least 1 test.
RES012errorSQL statement MUST begin with SELECT (case-insensitive, after whitespace trim).
RES013errorSQL statement MUST NOT contain blocked patterns: ATTACH DATABASE, LOAD_EXTENSION, PRAGMA, CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, REPLACE, TRUNCATE.
RES014errorNumber of parameters MUST match number of ? placeholders in the SQL statement.
RES015errorResource parameters MUST NOT have a location field in position.
RES016errorResource parameters MUST NOT use {{SERVER_PARAM:...}} values.
RES017errorResource name MUST match ^[a-z][a-zA-Z0-9]*$ (camelCase).
RES018errorQuery name MUST match ^[a-z][a-zA-Z0-9]*$ (camelCase).
RES019errorResource parameter primitives MUST be scalar: string(), number(), boolean(), or enum(). No array() or object().
RES020warningDatabase file SHOULD exist at validation time. Missing file produces a warning, not an error.
RES021erroroutput.schema.type must be 'array' for resource queries.
RES022errorTest parameter values MUST pass the corresponding z validation.
RES023errorTest objects MUST be JSON-serializable.
RES024errorsource: 'http' requires a url field. The URL MUST use HTTPS. (added in v4.2.0)
RES036errorsource: 'http' requires a path field (local cache file). Enforced by core (ResourceDatabaseManager). (added in v4.2.0)

RES001 and RES036 are enforced by core (ResourceDatabaseManager); all other RES codes are pipeline-level validation checks.

See 13-resources.md for the complete resource specification.


CodeSeverityRule
SKL001errorSkill file MUST export skill as a named export
SKL002errorskill.name is required, must be a string, must match ^[a-z][a-z0-9-]{0,63}$
SKL003errorskill.name must match the key under which the skill is registered (selection.skills, agent.skills) or the file basename without .mjs for namespace-scoped skills.
SKL004errorskill.version is required and MUST be 'flowmcp/4.0.0' (unified spec version).
SKL005errorEach entry in requires.tools must exist as a key in main.tools
SKL006errorEach entry in requires.resources must exist as a key in main.resources
SKL007errorskill.description is required, must be a string, maximum 1024 characters
SKL008errorEach {{input:key}} placeholder in content must have a matching entry in skill.input
SKL009errorinput[].values is required when type is 'enum' and forbidden otherwise
SKL010errorskill.content is required and MUST be a non-empty string
SKL011errorskill.output is required and MUST be a non-empty string
SKL012errorinput[].key must match ^[a-z][a-zA-Z0-9]*$ (camelCase)
SKL013errorinput[].type must be one of: string, number, boolean, enum
SKL014errorinput[].description is required and MUST be a non-empty string
SKL015errorinput[].required must be a boolean
SKL016errorSkill registration entries (selection.skills, agent.skills): file must end with .mjs
SKL017errorSkill registration entries (selection.skills, agent.skills): referenced file MUST exist
SKL018errorMaximum 4 skills per registration scope (selection or agent)
CodeSeverityRule
SKL020warning{{tool:name}} placeholder in content references a tool not listed in requires.tools
SKL021warning{{resource:name}} placeholder in content references a resource not listed in requires.resources
SKL022error{{skill:name}} placeholder references a skill not registered in the current scope (selection.skills, agent.skills, or the active namespace).
SKL023error{{skill:name}} target skill MUST NOT itself contain {{skill:...}} placeholders (1 level deep only)
SKL024warningEntry in requires.tools is not referenced via {{tool:...}} in content
SKL025warningEntry in requires.resources is not referenced via {{resource:...}} in content

See 14-skills.md for the complete skill specification.


CodeSeverityRule
DEP001errorrequires.tools entries in a skill MUST reference tools that exist in the same schema’s main.tools
DEP002errorrequires.resources entries in a skill MUST reference resources that exist in the same schema’s main.resources
DEP003warningSkill references a tool via {{tool:name}} in content but does not list it in requires.tools
DEP004warningSkill references a resource via {{resource:name}} in content but does not list it in requires.resources

Async fields are reserved for future versions. If present, they are ignored by the runtime. No validation errors are raised for async fields in v3.0.0.


CodeSeverityRule
SEC001errorStatic-scan codes (SEC001–SEC016, SEC020) are defined in 05-security.md. See that table for the canonical static-scan and library-allowlist codes.
SEC017errormain block contains non-serializable value (function, symbol, etc.)
SEC018errorShared list file contains forbidden pattern
SEC019errorShared list file contains executable code
SEC020errorrequiredLibraries contains unapproved package (see 05-security.md)

CodeSeverityRule
LST001errorList MUST export list as named export
LST002errorlist.meta.name is required and MUST be unique
LST003errorlist.meta.version is required and MUST be semver
LST004errorlist.meta.fields is required and MUST be a non-empty array
LST005errorEach field MUST have key, type, and description
LST006errorlist.entries is required and MUST be a non-empty array
LST007errorEach entry MUST have all required fields
LST008errorEntry field types MUST match meta.fields type declarations
LST009errordependsOn references MUST resolve to existing lists
LST010errorCircular dependencies are forbidden
LST011errorMaximum dependency depth: 3 levels

CodeSeverityRule
AGT001errorname is required, must match ^[a-z][a-z0-9-]*$
AGT002errordescription is required, must be a non-empty string
AGT003errormodel is required, must contain / (OpenRouter syntax)
AGT004errorversion must be flowmcp/4.0.0 (unified spec version).
AGT005errorsystemPrompt is required, must be a non-empty string
AGT006errortools[] is required, must be a non-empty array
AGT007errorEach tool reference MUST be a valid ID format (namespace/type/name)
AGT008errortests[] is required, minimum 3 tests
AGT009errorEach test MUST have an input field of type string
AGT010errorEach test MUST have an expectedTools field as a non-empty array
AGT011errorEach expectedTools entry MUST be a valid ID (contains /)
AGT012warningTests SHOULD cover different tool combinations
AGT013errorprompts (if present) must be an Object (not Array)
AGT014erroragent.skills (if present) must be an Object (not Array). Keys MUST NOT contain / (inline form), values are { file } objects pointing to agents/{name}/skills/*.mjs. See VAL110 and 06-agents.md.
AGT015errorresources (if present) must be an Object (not Array)
AGT016errorReferenced prompt/skill files MUST exist and be .mjs files
AGT017errorPrompt files MUST have export const prompt (with content or contentFile)
AGT018errorSkill files MUST have export const skill (with name, version, content/contentFile, requires, input, output)
AGT030errorAll IDs in agent.selections must be resolvable Selection IDs (added in v4.2.0)
AGT031errorelicitation.maxRounds must be a positive integer (>= 1) (added in v4.2.0)

AGT004, AGT030, and AGT031 are enforced by core at agent load/startup time; all other AGT codes are pipeline-level validation checks.

See 06-agents.md for the complete agent specification.


CodeSeverityRule
VAL100errorEvery Tool MUST have a meta block
VAL101errormeta.isReadOnly is required and MUST be a boolean
VAL102errormeta.isConcurrencySafe is required and MUST be a boolean
VAL103errormeta.isDestructive is required and MUST be a boolean
VAL104errormeta.searchHint is required and MUST be a non-empty string
VAL105errormeta.aliases is required and MUST be a string array
VAL106errormeta.alwaysLoad is required and MUST be a boolean
VAL107errorWhen enum values correspond to a Shared List, {{listName:alias}} MUST be used. Hardcoded enum values that duplicate a Shared List are forbidden.
VAL110errorSlash-Rule: Keys in selection.tools, selection.resources, selection.prompts, agent.tools, and agent.prompts that act as references MUST contain a / (full ID form). Keys in selection.skills and agent.skills MUST NOT contain a / (inline form with { file }). See 17-selections.md for the full slash-rule matrix.

See 19-mcp-integration.md for the complete meta block specification.


CodeSeverityRule
SEL001errorselection.whenToUse is required and MUST be a non-empty string
SEL002errorA Selection MUST reference at least 1 Primitive (tool, resource, prompt, or skill)
SEL003errorAll Primitive references in a Selection MUST be resolvable within the catalog
SEL004infoIf a Selection includes inline-skill objects, SkillValidator runs on each (recorded in the validation report). Optional — present only when inline skills exist.

See 17-selections.md for the complete Selection specification.


CodeSeverityRule
PRM001errorname is required, must be a string, must match ^[a-z][a-z0-9-]*$
PRM002errorversion is required and MUST be 'flowmcp-prompt/1.0.0'
PRM003errorExactly one of namespace or agent must be set (not both, not neither)
PRM004errortestedWith is required when agent is set, forbidden when namespace is set
PRM005errortestedWith value MUST contain / (OpenRouter model ID format)
PRM006errorEach dependsOn entry MUST resolve to an existing tool in the catalog
PRM007errorEach references[] entry MUST resolve to an existing prompt in the catalog
PRM008errorReferenced prompts MUST NOT themselves have references[] (one level deep only)
PRM009error{{type:name}} references in content must resolve to registered primitives (see PH002)
PRM010errorcontent OR contentFile must be present (XOR — exactly one MUST be set)

See 12-prompt-architecture.md for the complete prompt specification.


CodeSeverityRule
CAT001errorregistry.json must exist in the catalog root directory
CAT002errorname field MUST match the catalog directory name
CAT003errorAll shared[].file paths MUST resolve to existing files
CAT004errorAll schemas[].file paths MUST resolve to existing files
CAT005errorAll agents[].manifest paths MUST resolve to existing files
CAT006warningOrphaned files (exist in the catalog directory but are not listed in registry.json) should be reported
CAT007errorschemaSpec must be a valid FlowMCP specification version

See 15-catalog.md for the complete catalog specification.


CodeSeverityRule
ID001errorID MUST contain at least one / separator
ID002errorNamespace MUST match ^[a-z][a-z0-9-]*$
ID003errorResourceType (if present) must be one of: tool, resource, prompt, list
ID004errorName MUST NOT be empty
ID005warningShort form SHOULD only be used in unambiguous contexts
ID006errorFull form is required in registry.json and validation rules

See 16-id-schema.md for the complete ID schema specification.


CodeSeverityRule
PH001error{{type:name}} content MUST NOT be empty
PH002errorReferences (content containing /) must resolve to a registered tool, resource, or prompt in the catalog
PH003errorParameter names (content without /) must match ^[a-zA-Z][a-zA-Z0-9]*$
PH004error{{type:name}} placeholders are only valid in prompt/skill content fields, not in schema main blocks

See 02-parameters.md for the complete parameter and placeholder specification.


CodeSeverityRule
TST001errorEach tool MUST have at least 3 tests. Each resource query MUST have at least 3 tests. Each agent MUST have at least 3 tests.
TST002errorEach test MUST have a _description field of type string
TST003errorEach test MUST provide values for all required {{USER_PARAM}} parameters
TST004errorTest parameter values MUST pass the corresponding z validation
TST005errorTest objects MUST be JSON-serializable (no functions, no Date, no undefined)
TST006errorTest objects MUST only contain keys that match {{USER_PARAM}} parameter keys or _description
TST007warningTools/queries with enum or chain parameters SHOULD have tests covering multiple enum values
TST008infoConsider adding tests that demonstrate optional parameter usage
TST009errorEach agent test MUST have an input field of type string
TST010errorEach agent test MUST have an expectedTools field as non-empty array
TST011errorEach expectedTools entry MUST be a valid ID (contains /)
TST012warningAgent tests SHOULD cover different tool combinations
TST013infoConsider adding expectedContent assertions for richer validation

See 10-tests.md for the complete test specification including format, design principles, and the response capture lifecycle.


The CLI displays results grouped by severity with the rule code, severity, location, and description:

flowmcp validate etherscan/contracts.mjs
VAL014 error main.version: Must match ^4\.\d+\.\d+$ (found "1.2.0")
VAL031 error tools: Maximum 8 tools exceeded (found 10)
VAL036 warning getContractAbi: output schema is recommended
TST001 warning getContractAbi: No tests found
2 errors, 2 warnings
Schema cannot be loaded (has errors)

When all rules pass:

flowmcp validate etherscan/contracts.mjs
0 errors, 0 warnings
Schema is valid

With security flag:

flowmcp validate --security etherscan/contracts.mjs
SEC001 error Line 3: Forbidden pattern "import" detected
SEC017 error main.handlers.preRequest: Non-serializable value (function)
2 errors, 0 warnings
Schema cannot be loaded (has errors)