Skip to main content
Glama

Grafika Tbilisi MCP Server

ExecuteWixAPI

Destructive

Run JavaScript against the Wix REST API on site "Grafika" (https://www.grafikatbilisi.com/_api/mcp), on the visitor's behalf. The code runs in a sandbox and you get back whatever it returns.

PREFER THIS TOOL OVER CallWixSiteAPI. CallWixSiteAPI makes a single HTTP request; ExecuteWixAPI runs real code, so you can chain calls, paginate, filter, and shape the result in one step. Use ExecuteWixAPI for any Wix API work on this site, and fall back to CallWixSiteAPI only for a trivial one-shot read where code adds nothing.

DO A WHOLE RECIPE IN ONE CALL. When a task needs several requests — e.g. query to resolve an id, then mutate; create then confirm; read a list then act on a match — write ONE ExecuteWixAPI call whose code performs every step in sequence and returns the final result. Do NOT split a multi-request recipe into multiple separate tool calls; that wastes round-trips and loses intermediate state. If a recipe from the docs lists steps 1..N, the code should run steps 1..N.

CRITICAL CODE SHAPE:

  • The code parameter MUST be the function expression itself: async function() { ... } or async () => { ... }.

  • Do NOT send a script body like const result = await ...; return result;.

  • Do NOT call the function yourself. The tool calls it for you.

  • Put all const, await, and return statements inside the function body.

Do not rely on memory for Wix API endpoints, methods, schemas, or request bodies. Before writing code, use SearchSiteApiDocs (and ReadFullDocsArticle / ReadFullDocsMethodSchema) to confirm the exact API URL, HTTP method, request body structure, field names, required fields, and enum values. The URL usually starts with https://www.wixapis.com. Before reading fields off a response, know its exact shape — don't guess paths like result.id when it may be result.results[0].item.id. Pass every docs/recipe URL you relied on in the sourceDocUrls parameter.

Authentication: if you are signed in, send your access token in the Authorization header on the request — it is used for this call and you can omit visitorToken. Otherwise pass the visitorToken parameter (from GenerateVisitorToken; reuse the one already in your context, do not create a new one each call). Everything runs against this visitor site automatically — do NOT set scope, siteId, wix-site-id, or wix-account-id inside your code.

File and export limits: ExecuteWixAPI is only for Wix REST API calls and in-memory data shaping. It does not provide Node.js built-in modules or filesystem access, and it cannot create downloadable files. Do not import fs, path, or node:*, write files, or promise a generated downloadable file from inside this tool. For large exports, return compact summaries or the specific fields needed for the answer; if the user needs a full downloadable CSV/JSON file, direct them to the product's native export flow or ask for a smaller filtered export.

Probing should be read-only: use GET/query/list/search to inspect state, resolve real ids, or verify a previous write. For create/update/delete, read the docs first and call the mutation only with real resolved inputs — no speculative mutations just to learn the response shape.

Error handling: wix.request() throws when the Wix API returns an error. For dependent steps, let it throw so the failure is reported clearly. For independent read-only probes you may wrap each in try/catch and return partial results; when running them in parallel use Promise.allSettled (not Promise.all) so one failure doesn't discard the rest.

Available in your code:

interface WixRequestOptions {
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
  url: string;           // Full Wix API URL, e.g. "https://www.wixapis.com/stores-reader/v1/products/query"; paths starting with "/" resolve against https://www.wixapis.com
  body?: unknown;
}

interface WixResponse<T = unknown> {
  status: number;
  data: T;
  json(): Promise<T>; // Fetch-compatible alias for data
}

declare const wix: {
  request<T = unknown>(options: WixRequestOptions): Promise<WixResponse<T>>;
};

Return compact, task-focused data instead of raw API responses. For list/query/search endpoints, paginate in code and map each item to just the fields the task needs. When the code CREATES entities (create, bulk create, import, duplicate, upload), ALWAYS include the ID of every created entity in the returned object — e.g. { cartId } or { createdIds: [...] } — even if the user did not ask for them; follow-up steps, verification, and cleanup all need those IDs, and recovering them later costs extra query calls.

Example — a multi-step recipe (resolve a product by name, then add it to the cart) done in ONE call:

async function() {
  // Step 1: find the product
  const found = await wix.request({
    method: "POST",
    url: "https://www.wixapis.com/stores-reader/v1/products/query",
    body: { query: { filter: JSON.stringify({ name: "Florie Eau de Parfum" }) } }
  });
  const product = found.data.products?.[0];
  if (!product) return { error: "PRODUCT_NOT_FOUND" };

  // Step 2: create a cart with that product
  const cart = await wix.request({
    method: "POST",
    url: "https://www.wixapis.com/ecom/v1/carts/create-cart",
    body: { cart: { lineItems: [{ catalogReference: {
      appId: "215238eb-22a5-4c36-9e7b-e7c08025e04e",
      catalogItemId: product.id
    }, quantity: 1 }] } }
  });

  return { cartId: cart.data.cart?.id, productId: product.id, name: product.name };
}

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>",
      "reason": "<reason>",
      "sourceDocUrls": "<sourceDocUrls>"
    },
    "name": "ExecuteWixAPI"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript async function expression to execute against the Wix REST API. The value must be the function itself, for example `async function() { ... }` or `async () => { ... }`, not a script body and not an invoked function. Return the final answer from inside the function. Do not write top-level `const`, top-level `await`, or top-level `return` outside the function body. Do not import Node.js built-ins such as `fs`, `path`, or `node:*`, and do not try to write files from this code; ExecuteWixAPI only returns data from the function. Use `wix.request({ method, url, body })` for Wix API calls. Every call runs against the current visitor site; do not set `scope`, `siteId`, or auth headers. Full Wix API URLs and paths starting with `/` are supported. Wix REST API page size limits vary — use 100 as a safe default unless the method schema (via SearchWixAPISpec) confirms a higher limit is supported. For cursor-based APIs, pass the next cursor as `cursorPaging: { limit: 100, cursor: pagingMetadata.cursors.next }` — not inside `paging`. Check the method schema to confirm whether the API uses `paging` (offset-based) or `cursorPaging` (cursor-based) before paginating.
filesNoOptional bundle of raw file contents for uploads, so file bytes never go through the `code` JavaScript (no escaping, no string-literal/`${}`/backtick pitfalls). Never inline file contents in `code`. Format: sections delimited by a line `=== FILE: <path> ===` (text, raw) or `=== FILE: <path> base64 ===` (binary, base64); `<path>` is relative to the site root. Example: `=== FILE: index.html ===\n<!doctype html><img src="logo.png">\n=== FILE: assets/app.js ===\nconsole.log(1)\n=== FILE: logo.png base64 ===\niVBORw0KGgo...` In `code` they are the `files` global (`{ path, content, encoding?: "base64" }[]`); `wix.multipart()` turns them into one binary-safe `multipart/form-data` body: `const mp = wix.multipart(); await wix.request({ scope: "account", method: "POST", url, headers: { "Content-Type": mp.contentType }, body: mp.body });`. Use base64 entries for small assets (icons, logos, fonts) and for files you downloaded and are re-uploading; large images/video go in by URL (`<img src="https://...">`), not in the bundle. A file containing a line exactly like the delimiter is not supported.
reasonYesOne sentence explaining the original user request and why you are executing code to complete it.
attachmentsNoA file you have (attached in the chat or created in your sandbox), passed by its file id or path. In OpenAI clients (ChatGPT, Codex) it arrives as { download_url, file_id, file_name?, mime_type? }. Other clients send the path as written, which Wix can't read; there, leave this out and use `files`, or upload from your shell if it reaches the internet. Any type: a zip of a site, HTML, images, PDFs. The bytes are fetched here and appended to the `files` global as { path, content, encoding: "base64" } entries (path = file_name), so `wix.multipart()` and `wix.unzip()` work on them unchanged. Prefer this over base64 in `files` whenever you have a file handle. Up to 10 MB per call.
hasMutationsNoOptional. Whether the code writes site data (create, update, delete, import, upload) or only reads it.
visitorTokenNoVisitor access token, for an anonymous call. Omit it when you are signed in and sending your access token in the Authorization header - that token is used instead. Otherwise, if you have a visitor token in your context, ALWAYS use it and do not create a new one; if not, use the GenerateVisitorToken tool.
sourceDocUrlsYesThe URLs of the documentation, recipes, API articles, or schema sources where you confirmed the Wix REST endpoints, HTTP methods, request body shapes, auth contexts, and required fields used by this code. Include every docs/schema source needed for the endpoints and request shapes used in the code. The endpoints and request shapes must appear in those sources; do not guess them. Each value must be a valid URL like: - https://dev.wix.com/docs/api-reference/... (REST API reference docs) Use ["user-provided"] if the user gave you all endpoint and request details directly. Use ["other"] only when neither applies.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=true, openWorldHint=true) by disclosing sandbox limits (no Node built-ins, no filesystem, no downloadable files), that wix.request() throws on API errors, auth token handling, and read-only probing discipline before mutations. It also mandates returning created entity IDs — behavior annotations cannot express. Consistent with the destructive hint, since mutation guidance is explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, sibling preference, and the one-call-recipe rule before diving into code shape and limits, with headers making it scannable. It is long and repeats the function-expression rule (also in the `code` schema description) and restates filesystem/export limits twice, so some trimming is possible without losing guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter, high-blast-radius code-execution tool with no output schema, it covers everything an agent needs: call shape, auth paths, docs verification, pagination defaults, error handling, and what must appear in the return value. Nothing material about correct invocation is left undocumented.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description adds real meaning on top — the exact shape of `code` (function expression, not script body, not self-invoked), not setting scope/siteId/headers inside code, and passing every relied-upon URL in `sourceDocUrls`. Slight deduction because it repeats the code-shape rules already in the schema and the schema's `files` example shows `scope: "account"` while the description says never set scope, an internal inconsistency an agent must reconcile.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — run JavaScript against the Wix REST API on a named site, in a sandbox, returning whatever the function returns. It explicitly distinguishes itself from sibling CallWixSiteAPI (single HTTP request vs. real code), so an agent can choose without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use and when-not: prefer this over CallWixSiteAPI, fall back only for a trivial one-shot read, and do a full multi-step recipe in one call rather than splitting. It also names prerequisites by pointing to SearchSiteApiDocs / ReadFullDocsArticle / ReadFullDocsMethodSchema before writing code, and GenerateVisitorToken for anonymous auth.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources