Execute codeMONDAY_MCP_EXECUTE_CODE
Run arbitrary code in a monday-authenticated sandbox, without saving.
Prefer dedicated monday tools for individual reads, writes, and GraphQL queries/mutations — they render in the UI and are retried one step at a time. Reach for execute_code when code is genuinely the better tool:
- Bulk / multi-item work — batch operations, dedup, aggregations, joins across boards (one script beats N tool calls that accumulate context and compound failure)
- Data transformation — normalizing phones/dates, fuzzy matching, weighted scoring
- File I/O — parsing uploaded CSV/XLSX to import items, producing downloadable exports
- Multi-step workflows where each step's output gates the next
The sandbox has authenticated access to the monday.com API. You can make HTTP requests with GraphQL queries and mutations — authentication is handled automatically.
IMPORTANT: Network access is restricted to the following hosts: [api.monday.com/, mcp.monday.com/mcp]. Requests to any other host (or a different path on a restricted host) will be blocked. Use this tool to query boards, items, columns, users, updates, and any other monday.com API resource.
THE SANDBOX IS PER-CALL: a new empty container every call, destroyed when the call returns. Nothing written to disk survives, /tmp included. Never write a file in one call to read it in a later one, and don't invent staging paths for earlier tool results — none exist. To carry data forward, print it and pass it into the next call's code, or do the whole job in one call. Splitting a fan-out across calls only works if the later calls don't depend on the earlier ones' files.
FAIL WITH A NON-ZERO EXIT. A run that prints an error and exits 0 is recorded as a success. The monday.com API returns HTTP 200 with an "errors" array, so check the parsed body rather than the status code and raise when it is present. Let exceptions propagate; don't wrap the script in a bare try/except.
TIME LIMIT: 300s. A run that exceeds it is killed, so scope each call to finish well inside the limit instead of fetching everything in one script.
Don't call mcp.monday.com from inside the sandbox to reach monday tools — you already have them, and a tool missing from your tool list won't be found there either.
Example — monday.com GraphQL query, raising on errors (Python). Use this shape for every API call:
code: "import requests\ndef gql(query):\n body = requests.post('https://api.monday.com/v2', json={'query': query}).json()\n if 'errors' in body:\n raise RuntimeError(body['errors'])\n return body['data']\nprint(gql('{ users(limit:5) { id name email } }'))"
Example — monday.com GraphQL mutation (Python):
code: "import requests\nmutation = 'mutation { create_board(board_name: \"New Board\", board_kind: public) { id } }'\nbody = requests.post('https://api.monday.com/v2', json={'query': mutation}).json()\nif 'errors' in body:\n raise RuntimeError(body['errors'])\nprint(body['data'])"
Example — with vars (accessed via os.environ):
code: "import os, requests\nuser_id = os.environ['user_id']\nresp = requests.post('https://api.monday.com/v2', json={'query': f'{{ users(ids: [{user_id}]) {{ id name email }} }}'})\nprint(resp.json())"
vars: {"user_id": 12345}
Example — simple (Python):
code: "print('hello world')"
Example — with files (input and output):
code: "import json\ndata = json.load(open('/tmp/data.json'))\njson.dump({'count': len(data)}, open('/tmp/result.json', 'w'))"
files: [{"path": "/tmp/data.json", "content": "W3siaWQiOiAxfV0="}]
output_files: ["/tmp/result.json"]
Example — auto-collect outputs (write anything you want returned under /outputs):
code: "import os, json\nos.makedirs('/outputs', exist_ok=True)\njson.dump({'ok': True}, open('/outputs/result.json', 'w'))"
return_outputs: true