Skip to content

Remote API — API reference

Errors

CardNotFound

CardNotFound(card_id: int)

Bases: Exception

Raised by mutations when no card has the given id.

RelationError

Bases: ValueError

Raised when a kind, parent or link change would break a board invariant.

The invariants: a card is an epic exactly when its project is :data:EPIC_PROJECT; a parent is always an epic and an epic has no parent; epics take no blocks links and bind no sessions; blocks links form no loops. The message says which one, ready to show a user.

RemoteError

Bases: Exception

Base class for errors raised by the remote API.

SchemaMismatch

SchemaMismatch(database: str, expected: int, found: int)

Bases: RemoteError

A database's schema version is not the one this release expects.

Raised instead of migrating: the host pins its own mait-code release, so a newer or older instance needs the host upgrading (or the instance), not a schema change made by the host.

ATTRIBUTE DESCRIPTION
database

The database file name, e.g. "board.db".

expected

The schema version this release of mait-code expects.

found

The version recorded in the database (0 if it has none).

TransitionRefused

TransitionRefused(card_id: int, status: str)

Bases: RemoteError

A refine asked for a card or column outside backlog/refined.

ATTRIBUTE DESCRIPTION
card_id

The card the refine targeted.

status

The column involved - the card's current one, or the requested target.

Board

create_card

create_card(
    data_dir: Path,
    *,
    client: str,
    project: str,
    title: str,
    description: str | None = None,
    priority: str = "medium",
    origin_id: int | None = None,
    inherit_epic: bool = True,
) -> dict

Create a card in backlog, recording client as its creator.

There is no way to create a card anywhere but backlog.

With origin_id, the card joins the origin's epic and gets a from -> #<origin_id> reference, in one transaction. An epic that is done or archived is refused rather than joined, since nothing would surface the card under it; pass inherit_epic=False to keep the reference and join no epic. Without an origin, inherit_epic=True has nothing to inherit and changes nothing.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

client

Name of the calling client, stored as created_by.

TYPE: str

project

Project the card belongs to.

TYPE: str

title

Card title.

TYPE: str

description

Optional markdown description.

TYPE: str | None DEFAULT: None

priority

"low", "medium" or "high".

TYPE: str DEFAULT: 'medium'

origin_id

The card this one was split from or raised as a follow-up of, in any project.

TYPE: int | None DEFAULT: None

inherit_epic

Whether to join the origin's epic.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
dict

The new card, with its (empty) comments.

RAISES DESCRIPTION
ValueError

If client, project or title is blank, client is too long, priority is unknown, or inherit_epic is False without an origin_id.

CardNotFound

If no card has the id origin_id.

RelationError

If the origin is an epic, or its epic is done or archived and inherit_epic is True.

get_card

get_card(data_dir: Path, card_id: int) -> dict

Return one card with its comments.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

card_id

The card's id.

TYPE: int

RETURNS DESCRIPTION
dict

The card dict with a comments list, as show --json emits it.

RAISES DESCRIPTION
CardNotFound

If no card has that id.

get_epic

get_epic(data_dir: Path, epic_id: int) -> dict

Return one epic with its members, progress and comments.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

epic_id

The epic's id.

TYPE: int

RETURNS DESCRIPTION
dict

The epic in the mc-tool-board epic show --json shape: a card dict

dict

plus members (its non-archived member cards), progress and

dict

comments.

RAISES DESCRIPTION
CardNotFound

If no card has that id.

RelationError

If the card isn't an epic.

list_cards

list_cards(
    data_dir: Path,
    *,
    project: str | None = None,
    statuses: Iterable[str] | None = None,
    tag: str | None = None,
    search: str | None = None,
) -> list[dict]

Return cards ordered priority-then-oldest.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

project

Restrict to one project, or None for every project.

TYPE: str | None DEFAULT: None

statuses

Restrict to these columns; None means every column except archived.

TYPE: Iterable[str] | None DEFAULT: None

tag

Restrict to cards carrying this tag.

TYPE: str | None DEFAULT: None

search

Case-insensitive substring of the title.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
list[dict]

Card dicts in the mc-tool-board show --json shape, without

list[dict]

comments.

RAISES DESCRIPTION
ValueError

If statuses names an unknown column.

list_epics

list_epics(
    data_dir: Path, *, include_done: bool = False
) -> list[dict]

Return epics with their member progress, priority-then-oldest.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

include_done

Also return finished epics (archived ones never are).

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
list[dict]

Epic dicts in the mc-tool-board epic list --json shape: a card

list[dict]

dict plus progress (member counts per column, total and

list[dict]

waiting).

list_projects

list_projects(data_dir: Path) -> list[str]

Return the distinct projects that have cards, sorted.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

refine_card

refine_card(
    data_dir: Path,
    card_id: int,
    *,
    client: str,
    description: str | None = None,
    acceptance: str | None = None,
    to: str = REFINED,
) -> dict

Edit a card's description/acceptance and place it in backlog or refined.

The card must currently sit in backlog or refined, and to must be one of those two. The change and a comment authored by client recording it are written in one transaction, after re-checking the card's column under the write lock.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

card_id

The card to refine.

TYPE: int

client

Name of the calling client, recorded as the comment author.

TYPE: str

description

New description, or None to leave it.

TYPE: str | None DEFAULT: None

acceptance

New acceptance criteria, or None to leave them.

TYPE: str | None DEFAULT: None

to

Target column, "refined" (default) or "backlog".

TYPE: str DEFAULT: REFINED

RETURNS DESCRIPTION
dict

The card after the change, with its comments.

RAISES DESCRIPTION
CardNotFound

If no card has that id.

RelationError

If the card is an epic.

TransitionRefused

If the card is outside backlog/refined, or to is any other column.

ValueError

If client is blank or too long, or the call would change nothing.

Memory

memory_search_status

memory_search_status(data_dir: Path) -> dict

Report whether memory search can use the instance's vectors.

The check :func:search_memories makes on every query, asked up front: the provider, model and width the host is configured to embed with, against the record of what built the instance's vectors. When they disagree, search runs keyword-only. Nothing is embedded and the embedding provider is never loaded, so this is cheap enough for a health check.

Note

Like :func:search_memories, the configured side comes from the host's environment and settings file - see the module docstring.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

RETURNS DESCRIPTION
dict

A dict with usable (bool), state ("match",

dict

"unknown", "empty", "absent", "dimension" or

dict

"model"), reason (one line), configured (provider,

dict

model, dim) and recorded (the same keys, or None

dict

when the instance has no record). "unknown" and "empty" are

dict

usable; "absent", "dimension" and "model" are not.

dict

usable says only that the vectors fit the configured model, not

dict

that the provider will load: a missing model download, boto3 or

dict

AWS credentials still leaves search keyword-only.

RAISES DESCRIPTION
FileNotFoundError

If the instance has no memory.db.

SchemaMismatch

If its schema version is not this release's.

search_memories

search_memories(
    data_dir: Path,
    query: str,
    *,
    limit: int = 10,
    entry_type: str | None = None,
    project: str | None = None,
) -> list[dict]

Search memories (keyword plus vector) and rank them.

The same hybrid search and composite ranking as mc-tool-memory search. Superseded and retired entries are excluded.

Note

Unlike the rest of this module, the embedding provider and the ranking weights come from the host's environment and settings file - see the module docstring for exactly what to pin.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

query

Search text.

TYPE: str

limit

Maximum number of results.

TYPE: int DEFAULT: 10

entry_type

Restrict to one entry type (e.g. "preference").

TYPE: str | None DEFAULT: None

project

Project context: global entries plus that project's are searched, and the project's own rank higher. None searches every scope.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
list[dict]

Memory entry dicts, best first, each with a score key.

RAISES DESCRIPTION
ValueError

If query is blank or limit is not positive.

Reminders

list_reminders

list_reminders(data_dir: Path) -> list[dict]

Return active (undismissed) reminders, ordered by due time.

PARAMETER DESCRIPTION
data_dir

The instance's data directory.

TYPE: Path

RETURNS DESCRIPTION
list[dict]

Dicts with id, what, due (ISO 8601 string) and

list[dict]

overdue (bool).