Skip to main content
Glama
inbarajaldrin

MCP Tools Orchestrator

execute_composed_code

Run Python code to orchestrate MCP tools from multiple servers, automating sequential or heuristic workflows with loops and error handling.

Instructions

Execute Python code that orchestrates tools from multiple MCP servers.

Used to automate a heuristic search or sequential execution using loops and error handling.

Example: ```python from unified_api import *

items = ["item_a", "item_b", "item_c"]
results = []

for item in items:
    server__prepare(target=item, mode="sim")
    result = server__execute_action(name=item, value=123, mode="sim")

    if result.get("result") != "success":
        server__restore_state()
        continue

    server__finalize(item=item)
    results.append({"item": item, "status": "success"})

print(f"Processed {len(results)}/{len(items)} successfully")
```

Returns: output: stdout/stderr from execution (partial results if aborted/timed out) returncode: 0=success, 1=error, -1=timeout status: "success" | "failed" | "aborted" | "timeout" session_id: present when persistent=True and status="success" session_vars: list of saved variable names, present with session_id reason: present when status="aborted" — user cancelled operation. Do not retry. tool: present when status="aborted" — which tool was cancelled

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code to execute. Has access to all MCP tools via 'from unified_api import *'. Tools are called as Python functions: server_name__tool_name(param=value). Replace dashes with underscores in server names.
persistentNoIf True, variables from this execution are saved and restored on the next call with the same session_id. Useful for multi-step workflows where later calls need results from earlier ones.
session_idNoSession identifier for persistent execution. Use the same ID across calls to share state between executions.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior5/5

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

With annotations already indicating non-read-only, non-idempotent, open-world behavior, the description adds rich operational detail: timeout and abort statuses, partial results, session persistence behavior, and the instruction not to retry after user cancellation. This goes well beyond what the annotations convey.

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

Conciseness3/5

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

The description is front-loaded with purpose and usage, but includes a lengthy example and a detailed return-value list that duplicates information available in the output schema. The example is useful for a code-execution tool, but the return section is not fully earning its place.

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

Completeness4/5

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

For a complex code-execution tool, the description covers execution context, example usage, return statuses, session behavior, and abort handling. It is nearly complete, though it could mention additional constraints such as sandboxing, permissions, or resource limits.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents code, persistent, and session_id. The description provides an example of the calling convention and return details, but adds little semantic meaning about the parameters themselves beyond what the schema states.

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

Purpose4/5

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

The description clearly states a specific verb and resource: execute Python code that orchestrates tools from multiple MCP servers. It distinguishes itself from list_available_tools by function, though it does not explicitly name the sibling or contrast the two.

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

Usage Guidelines4/5

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

It gives clear usage context, saying the tool is used to automate heuristic search or sequential execution with loops and error handling. It does not provide explicit when-not-to-use guidance or name alternatives.

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

Deploy Server

Other Tools