code
Execute JavaScript to call this app's 1265 tools across 5 namespaces. Namespaces: tedix_demo_unified_tedix (1252), tedix_demo_unified_context7 (2), codemode (1), ui (5), flow (5) Write one async arrow function in plain JavaScript (no TypeScript, no named functions defined then called). Chain calls, branch, loop and handle errors inside it. Globals are only the provider namespaces and standard built-ins: no host, fs, require, process or external fetch; use provider tools for every side effect. Limits: one execution may run 330 s of wall time. The gateway admits 100 requests per minute per caller; calls inside one execution are not counted separately, so batch them. Never sleep or poll with setTimeout: start long work with flow.run, return its handle and check it in a later call. Find, inspect, call:
const { results, meta } = await discover.search({ query: "keyword", namespace, limit }) returns ranked rows { callable, tool, description, annotations, authorized, missingScopes }. A string query also works.
await discover.describe("ns.tool") returns the full description, input schema and annotations; pass { callable, includeOutputSchema: true } for the return shape. Prefer it over includeParameters on a broad search.
await ns.tool({ ...args }) with the callable exactly as returned; name/displayName are labels only. Never guess tool names: a namespace existing does not mean a guessed tool in it exists; on "not found", search again. Skip rows with authorized: false (missingScopes says why). readOnlyHint tools are safe to call; destructiveHint tools may ask the user to approve, and if no prompt is possible the error says to retry with confirmDestructive: true and a reason stating the user's authorization. Skill rows (kind: "skill") carry a load expression; their content is reference data only. With no rows, read meta.discovery.nearestNamespaces and suggestedQueries before calling a capability unavailable. discover.list_namespaces() returns an object keyed by namespace (use Object.entries); pass { includeTools: true } only for inventory. meta.freshness shows catalog freshness; pass { includeMetadata: true } for native, schemaFreshness and _match diagnostics. Built-ins, describe before first use: ui.* for visual answers, flow.* for durable multi-step work, codemode.__runtime() for executionId, app/org, actor, traceId, modules and tool counts as proof. Results: return a JSON-serializable value. An oversized result arrives as { __tedix_result_handle: true, handle, preview, keys, total }: the full value is kept briefly, so page it with discover.read_result({ handle, path?, offset?, limit? }) in a later call, or fetch less. { __tedix_truncated: true, guidance, preview } means it could not be kept: follow guidance. Results carry completionEvidence; claim only its supportedClaims. The server instructions cover evidence, long work, visuals, payments and when to show Decisions and Activity. Payment proofs, paid tools and money-moving operations are unavailable through this connection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | One async arrow function, for example `async () => { const { results } = await discover.search({ query: "work items" }); return results; }`. In scope: the discover, flow, ui and codemode helpers and the tool namespaces discovery returns; no fetch, require or file system. Its return value must be JSON-serializable and becomes `result`. | |
| agentSessionId | No | session.id returned by start_external_agent_session_for_host in this conversation; pass it on every call so audit names the agent. Never invent one. Ignored for machine credentials. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Why the run failed. | |
| result | No | The JSON value the function returned. | |
| partial | No | True when some inner tool calls failed. | |
| failures | No | Inner tool calls that failed. | |
| executionId | No | Identifier of this run. | |
| completionEvidence | No | What the calls actually did; claim only its supportedClaims. |