Skip to main content
Glama

list_tasks

Retrieve all tasks within a specified project and domain to manage and track progress effectively.

Instructions

List all tasks in a project and domain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
projectYes

Implementation Reference

  • MCP tool handler for list_tasks in Union v2 server, which initializes Flyte context and delegates to resources.list_tasks.
    @mcp.tool()
    @require_auth
    async def list_tasks(
        project: str,
        domain: str,
        ctx: Context,
    ) -> list[dict]:
        """List all tasks in a project and domain."""
        _init(project, domain)
        print(f"Listing tasks in project {project} and domain {domain}")
        return [task.to_dict() for task in await resources.list_tasks(project, domain)]
  • MCP tool handler for list_tasks in Union v1 server, which creates remote client and delegates to resources.list_tasks.
    @mcp.tool()
    @require_auth
    def list_tasks(
        project: str,
        domain: str,
        ctx: Context,
    ) -> list[resources.TaskMetadata]:
        """List all tasks in a project and domain."""
        remote = _remote(project, domain)
        print(f"Listing tasks in project {project} and domain {domain}")
        return resources.list_tasks(remote, project, domain)
  • Helper function in v2 resources that lists tasks using Flyte's Task.listall and fetches details.
    async def list_tasks(
        project: str | None = None,
        domain: str | None = None,
    ) -> list[flyte.remote.Task]:
        tasks = []
        for task in flyte.remote.Task.listall(project=project, domain=domain):
            tasks.append(await get_task(task.name, project=project, domain=domain))
        return tasks
  • Helper function in v1 resources that lists tasks using UnionRemote client and converts to TaskMetadata.
    def list_tasks(remote: union.UnionRemote, project: str, domain: str) -> list[TaskMetadata]:
        from flytekit.models.common import NamedEntityIdentifier
    
        id = NamedEntityIdentifier(project=project, domain=domain)
        task_models, _ = remote.client.list_tasks_paginated(id, limit=100)
        tasks = [t.to_flyte_idl() for t in task_models]
        return [
            TaskMetadata(
                name=task.id.name,
                description=task.short_description,
                inputs=proto_to_json(task.closure.compiled_task.template.interface.inputs),
                outputs=proto_to_json(task.closure.compiled_task.template.interface.outputs),
            )
            for task in tasks
        ]
  • Pydantic schema for TaskMetadata used in v1 list_tasks responses.
    class TaskMetadata(BaseModel):
        name: str
        description: str
        inputs: dict
        outputs: dict

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