Skip to main content
This example combines both MCP execution styles:
  • Workflow-owned tool call in dynamic for deterministic fetch.
  • Model-owned MCP capabilities in uses for agent reasoning context.
If you are new to MCP in Superwire, read MCP and Tools Overview first.
input {
    task_id: number
}

secrets {
    api_key: string
    mcp_token: string
}

provider llm from openai {
    endpoint: "https://api.openai.com/v1"
    api_key: secrets.api_key
}

model fast from llm {
    id: "gpt-4.1-mini"
}

mcp tasks {
    endpoint: "http://localhost:8000/mcp/tasks"

    headers {
        Authorization: "Bearer {{ secrets.mcp_token }}"
    }
}

from mcp.tasks {
    prompt task_writer_instructions
    resource project_readme
}

tool fetch_task from mcp.tasks.tool.fetch_task {
    input {
        task_id: number
    }

    output {
        title: string
        description: string
        status: string
    }
}

dynamic {
    task: call tool.fetch_task {
        bindings {
            task_id: input.task_id
        }
    }
}

agent writer {
    model: model.fast

    uses: [
        prompt.task_writer_instructions,
        resource.project_readme,
        tool.fetch_task,
    ]

    instruction: "Write a concise task update for {{ dynamic.task.title }}."

    output {
        update: string
    }
}

output {
    update: agent.writer.update
}
Why this pattern works:
  • call tool.fetch_task guarantees task data exists before agent execution.
  • uses gives the agent scoped access to only the prompt/resource/tool it needs.
  • The final output stays typed and stable for application consumers.