agora.mcp.handlers

MCP tool handlers.

Each handler is a plain async callable that takes a dict of validated arguments and returns a JSON-serializable dict. Handlers live separate from transport (stdio / HTTP / SSE) so they can be unit-tested directly without running a real MCP session.

The AgoraHandlers class holds a running orchestrator plus a small in-memory registry of spawned agents, projects, flows, and tasks for lookup by id. State is intentionally ephemeral — the canonical source is the Matrix room graph; this registry is a cache so the MCP caller can reference objects by id without rehydrating on every call.

Classes

AgoraHandlers

Thin bridge between MCP tool calls and the Orchestrator.

class agora.mcp.handlers.AgoraHandlers[source]

Bases: object

Thin bridge between MCP tool calls and the Orchestrator.

__init__(orchestrator, flows_dir='./flows')[source]
async spawn_agent(args)[source]

Create an identity room for a new agent. Returns {agent_id, room_id}.

async assign_task(args)[source]

Single-task mode: execute one task on an agent synchronously.

async run_project(args)[source]

Kick off a full project run. Runs async; poll via agent_status.

async create_flow(args)[source]

Create and persist a Flow from a spec dict, returning its id/path.

async run_flow(args)[source]

Instantiate a saved flow and run it as a project.

async list_flows(_args=None)[source]

List known flows — both the ones created this session and YAML files on disk.

async get_flow(args)[source]

Return a flow’s resolved contents (agents, task_graph).

async validate_flow(args)[source]

Parse + validate a flow YAML snippet. Returns {valid, errors, summary}.

async agent_status(args)[source]

Report status for an agent, a project, or everything (no args).

async get_kanban(args)[source]

Return a kanban snapshot derived from the handler registry.

The pure observe.kanban.build_kanban function operates on Matrix events; for the in-memory registry we emit synthetic task events so the same fold applies and the two paths cannot diverge.

async export_report(args)[source]

Write a standalone HTML report derived from handler state + synthetic events.

property agents: dict[str, _AgentEntry]
property projects: dict[str, _ProjectEntry]
property tasks: dict[str, _TaskEntry]
property flows: dict[str, _FlowEntry]