Execute Unraid GraphQL operations
executeRun JavaScript in a sandbox to query or mutate Unraid's GraphQL API using the unraid.local namespace.
Instructions
Run Unraid GraphQL operations by writing JavaScript that uses the unraid.local namespace.
Although the sandbox is JavaScript, the calls below appear synchronous — await is supported and recommended. Each call returns once the host-side HTTP request settles.
Surfaces:
unraid.local.graphql({ query, variables, operationName })— POST any GraphQL document directly to/graphql. Returns the unwrappeddatafield.unraid.local.query.<fieldName>({ args, fields })— typed query call.argsmap to GraphQL variables;fieldsis either a GraphQL selection-set string (no wrapping braces) or a shorthand array of leaf field names.fieldsis required for non-scalar return types.unraid.local.mutation.<fieldName>({ args, fields })— typed mutation call, same rules.unraid.local.request({ method, path, body, headers })— raw HTTP escape hatch for endpoints outside GraphQL. Returns{ status, body, headers }.unraid.local.spec—{ title, version, sourceUrl, queryCount, mutationCount }for diagnostics.
Operations are async — use await. The final expression is the tool result.
Examples
// Read system info via a typed query.
const info = await unraid.local.query.info({
fields: ['os { distro release kernel }', 'versions { unraid api }', 'cpu { manufacturer brand cores }'].join(' '),
});
return info;// List Docker containers with a shorthand selection.
const containers = await unraid.local.query.dockerContainers({
fields: ['id', 'names', 'state', 'status', 'image'],
});
return containers.map(function (c) { return { name: c.names[0], state: c.state }; });// Raw GraphQL document — handy for fragments and aliases.
const data = await unraid.local.graphql({
query: 'query { array { state capacity { kilobytes { free total } } } }',
});
return data;Limits
Hard ceiling on API calls per execute; exceeded → error.
Sandbox memory + time bounded.
Credentials never enter the sandbox.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute against the live Unraid GraphQL API. Use await — operations are async. |