Skip to main content
Glama

Execute Cumulocity API Call

execute

Run custom JavaScript code to query and manipulate the Cumulocity IoT platform API using the cumulocity.request() method.

Instructions

Execute JavaScript code against the Cumulocity API. First use the query tool to find the right endpoint, then write an async JavaScript function expression that uses cumulocity.request().

This MCP currently exposes the release (latest) bundled core OpenAPI snapshot together with the other bundled product specs for the query tool. Bundled specs on this connection: core (release), dtm (release). Enabled bundled OpenAPI parts for execute policy: core, dtm.

Use coreSpec for the main Cumulocity REST surface such as inventory, alarms, events, measurements, identity, device control, users, tenants, audit, and the broader platform APIs. Use dtmSpec for Digital Twin Manager work such as schema definitions, asset models, linked series, and DTM asset or definition APIs.

Available in your module:

type CumulocityRequestOptions = { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' path: string body?: unknown headers?: Record<string, string> }

declare const cumulocity: { request<T = unknown>(options: CumulocityRequestOptions): Promise }

Your code must evaluate to a function. The top-level binding cumulocity is available automatically. The sandbox assigns your function to a local variable, invokes it, and returns its result.

Recommended shape: async () => { ... }

Inside that function, call await cumulocity.request({ method, path, ... }) and return the final value you want.

Internally the sandbox classifies execution as success, blocked, or failed.

Tool output behavior:

  • On success, the actual function result is returned in Toon format.

  • On blocked or failed execution, the tool returns a plain text message.

The current MCP connection may deny certain method/path combinations and may also use an allow list. The query tool does not annotate or filter visible operations inside a spec for that policy, and cumulocity.request(...) will reject blocked calls before sending them. When that happens, the tool returns a plain text connection-policy message. That is not a Cumulocity API failure and retrying the same operation through the same connection will not help.

This MCP can access multiple tenants. Use list-credentials first if the tenant is unclear, then pass the chosen tenantUrl to this tool.

Examples: async () => { return await cumulocity.request({ method: 'GET', path: '/inventory/managedObjects?pageSize=5', }) }

async () => { const alarms = await cumulocity.request({ method: 'GET', path: '/alarm/alarms?pageSize=10&withTotalPages=true', })

return alarms }

async () => { const asset = await cumulocity.request({ method: 'GET', path: '/assets?pageSize=5', })

return asset }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesAn async JavaScript function expression. The top-level binding `cumulocity` is available automatically. Return the final result from that function. `await` is supported.
tenantUrlYesThe Cumulocity tenant URL against which the operation is executed.
Behavior5/5

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

Discloses sandbox execution, success/blocked/failed classification, output format (Toon vs plain text), connection policy restrictions, and multi-tenant behavior, compensating for lack of annotations.

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

Conciseness5/5

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

Well-structured with concise summary, detailed usage sections, type definitions, and examples; every sentence adds value without redundancy.

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?

Covers input, execution model, error handling, output behavior, multi-tenant setup, and provides numerous examples, making it fully self-contained despite missing output schema.

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

Parameters5/5

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

Adds rich meaning beyond the 100% schema coverage: explains how to write the async function, provides type definitions for `cumulocity.request`, and gives multiple examples.

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?

Clearly states 'Execute JavaScript code against the Cumulocity API' with specific verb and resource, and differentiates from siblings 'query' and 'list-credentials' by explaining when each is used.

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?

Explicitly guides to first use 'query' for endpoint discovery and 'list-credentials' for tenant selection, and explains what happens on blocked/failed executions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/schplitt/mc8yp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server