Skip to main content
Glama

run_task

Execute Union tasks using natural language by specifying project, domain, name, and inputs to automate workflows and applications.

Instructions

Run a task with natural language.

- Based on the prompt and inputs dictionary, determine the task to run
- Format the inputs dictionary so that it matches the task function signature
- Invoke the task

Args:
    project: Project to run the task in.
    domain: Domain to run the task in.
    name: Name of the task to run.
    inputs: A dictionary of inputs to the task.

Returns:
    A dictionary of outputs from the task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
inputsYes
nameYes
projectYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary MCP tool handler and registration for 'run_task' in v2 server. Decorated with @mcp.tool() and @require_auth. Initializes Flyte and calls the resources helper.
    @mcp.tool()
    @require_auth
    async def run_task(
        name: str,
        inputs: dict,
        project: str,
        domain: str,
        ctx: Context,
    ) -> dict:
        ctx.info(f"Running task {name} in project {project} and domain {domain}")
        """Run a task with natural language.
    
        - Based on the prompt and inputs dictionary, determine the task to run
        - Format the inputs dictionary so that it matches the task function signature
        - Invoke the task
        
        Args:
            project: Project to run the task in.
            domain: Domain to run the task in.
            name: Name of the task to run.
            inputs: A dictionary of inputs to the task.
    
        Returns:
            A dictionary of outputs from the task.
        """
        # Based on the prompt and inputs dictionary, determine the task
        _init(project, domain)
        return (await resources.run_task(name, inputs, project, domain)).to_dict()
  • Core helper function that fetches a Flyte task and runs it asynchronously, returning action details. Called by the v2 server handler.
    async def run_task(
        name: str,
        inputs: dict,
        project: str | None = None,
        domain: str | None = None,
        version: str | None = None,
    ) -> flyte.remote.ActionDetails:
        task = flyte.remote.Task.get(
            name=name,
            project=project,
            domain=domain,
            version=version,
            auto_version="latest" if version is None else None,
        )
        run: flyte.remote.Run = flyte.run(task, **inputs)
        return await run.action.details()
  • v1 MCP tool handler and registration for 'run_task'. Directly fetches and executes task using union remote API.
    @mcp.tool()
    @require_auth
    def run_task(
        name: str,
        inputs: dict,
        project: str,
        domain: str,
        ctx: Context,
    ) -> dict:
        ctx.info(f"Running task {name} in project {project} and domain {domain}")
        """Run a task with natural language.
    
        - Based on the prompt and inputs dictionary, determine the task to run
        - Format the inputs dictionary so that it matches the task function signature
        - Invoke the task
        
        Args:
            project: Project to run the task in.
            domain: Domain to run the task in.
            name: Name of the task to run.
            inputs: A dictionary of inputs to the task.
    
        Returns:
            A dictionary of outputs from the task.
        """
        # Based on the prompt and inputs dictionary, determine the task
        remote = _remote(project, domain)
        task = remote.fetch_task(project=project, domain=domain, name=name)
        execution = remote.execute(task, inputs, project=project, domain=domain)
        return resources.proto_to_json(execution.to_flyte_idl())
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'determine the task to run' and 'format the inputs dictionary' which suggests some processing logic, but doesn't explain authentication needs, error handling, rate limits, or what happens if the task fails. For a tool that executes tasks, this is a significant gap.

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

Conciseness4/5

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

The description is reasonably structured with a clear opening statement followed by bullet points and an Args/Returns section. However, the 'Based on the prompt' phrase is ambiguous and could be more precise. Overall, it's efficient but not perfectly front-loaded.

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

Completeness3/5

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

Given 4 parameters with 0% schema coverage and no annotations, but with an output schema present, the description provides basic parameter explanations and mentions returns. However, for a task execution tool with complex inputs (dictionary with additionalProperties), more context about input formatting, error cases, and execution behavior would be helpful.

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 0%, so the description must compensate. It lists all 4 parameters in the Args section with brief explanations, but doesn't provide examples, constraints, or format details. The description adds basic meaning beyond the bare schema but doesn't fully compensate for the complete lack of schema descriptions.

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

Purpose3/5

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

The description states 'Run a task with natural language' which indicates the verb (run) and resource (task), but it's vague about what 'natural language' means in this context. It doesn't clearly differentiate from sibling tools like 'run_workflow' or 'get_task' beyond the basic resource name.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives like 'run_workflow' or 'get_task'. The description mentions 'Based on the prompt and inputs dictionary' but doesn't clarify what constitutes a 'prompt' or when this approach is preferred over more specific tools.

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/unionai-oss/union-mcp'

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