Patterns
Check pattern
Check a pattern file.
POST
/v1/patterns/checkTL;DR
| Question | Answer |
|---|---|
| What does it do? | Check a pattern file. |
| Which tool does the same? | check_pattern |
| What does it take? | A JSON body of type CheckPatternInput. |
| What does it return? | Status 200 with a body of type CheckPatternResponse. |
| What can go wrong? | 400 the body failed schema validation; 401 the api key is missing or not valid; 403 the account is on the free plan, which does not include the rest drawing and checking routes (plan.rest_not_included); 413 the body is larger than the size cap; 429 too many requests. Every failure uses the one error envelope. |
What it does
Checks a pattern file as a save to an organisation checks it. A file that would not be saved is a normal 200 result with valid false and every problem with its field and a fix; a valid one comes back with each flavour filled with its slot defaults. Stores nothing; saving is POST /orgs/{org}/patterns.
Request body
The body has the type CheckPatternInput.
| Field | Type | Required | Description |
|---|---|---|---|
pattern | object | yes | The pattern file. Every field is described at https://docs.plotwork.dev/schemas/plotwork.pattern.json (opens in a new tab); get_pattern with file true gives one to start from. |
pattern.$schema | string | no | |
pattern.name | string | yes | |
pattern.title | string | yes | |
pattern.summary | string | yes | |
pattern.whenToUse | string | no | |
pattern.tags | string[] | no | |
pattern.templates | object | yes | |
pattern.templates.neutral | string | no | |
pattern.templates.aws | string | no | |
pattern.templates.azure | string | no | |
pattern.templates.gcp | string | no | |
pattern.slots | object[] | no | |
pattern.slots[].id | string | yes | |
pattern.slots[].default | string | yes | |
pattern.slots[].meaning | string | yes | |
pattern.notes | object | no | |
pattern.notes.keep | string | no | |
pattern.notes.rename | string | no | |
pattern.notes.split | string | no |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Whether it would be saved, its problems, and the source of each flavour. | CheckPatternResponse |
| 400 | The body failed schema validation. | ErrorResponse |
| 401 | The API key is missing or not valid. | ErrorResponse |
| 403 | The account is on the Free plan, which does not include the REST drawing and checking routes (plan.rest_not_included). | ErrorResponse |
| 413 | The body is larger than the size cap. | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
Response body
A 200 answer has the type CheckPatternResponse.
| Field | Type | Required | Description |
|---|---|---|---|
valid | boolean | yes | True when the file passes every check a save runs, so publish_pattern or the portal's import would take it. |
id | string | null | yes | The id it would have, org: |
kind | string | null | yes | The kind of diagram every flavour draws; null when not valid. |
flavours | ("neutral" | "aws" | "azure" | "gcp")[] | yes | The flavours the file gives. |
problems | object[] | yes | Every problem at once, each with its field and a fix. Empty when valid. |
problems[].field | string | yes | Where the problem is: name, title, templates.aws, slots.0.default, and so on; json for a file that is not JSON. |
problems[].message | string | yes | |
problems[].hint | string | yes | How to fix it. |
sources | object | yes | Each flavour filled with the slot defaults, keyed by flavour: send one to draw_diagram to see it and its warnings. Empty when not valid. |
next | string | yes | The next step in one sentence. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
check_pattern | The same operation as an MCP tool |
| Tool reference | The operations as callable tools |