# Models: M

> API models starting with M.

## `MCPAuthHeader`

One header a `header` auth sends: `<name>: <prefix><secret>`.

- `name: str`
- `secret_ref: kindgi.client.MCPEndpointSecretRef` (`secretRef` on the wire)
- `prefix: str | None` (optional)

## `MCPBasicAuth`

HTTP Basic: the runtime sends `Authorization: Basic base64(<username>:<secret>)`, with the secret `secretRef` names (a WordPress Application Password, for one).

- `scheme: Literal['basic']`
- `username: str`
- `secret_ref: kindgi.client.MCPEndpointSecretRef` (`secretRef` on the wire)

## `MCPEndpoint`

- `endpoint_id: str` (`endpointId` on the wire)
- `name: str`
- `transport: Literal['stdio', 'http-sse', 'streamable-http']`
- `config: kindgi.client.Config | kindgi.client.Config1 | kindgi.client.Config2`
- `secret_ref: kindgi.client.MCPEndpointSecretRef | None` (`secretRef` on the wire) (optional)
- `auth: kindgi.client.MCPBasicAuth | kindgi.client.MCPOAuth2ClientCredentialsAuth | kindgi.client.MCPHeaderAuth | None` (optional)
- `instructions: str | None` (optional)
- `metadata: dict[str, Any] | None` (optional)
- `send_traceparent: bool | None` (`sendTraceparent` on the wire) (optional)
- `secret_scopes: dict[str, kindgi.client.RecordedSecretScope1 | kindgi.client.RecordedSecretScope2 | kindgi.client.RecordedSecretScope3 | None] | None` (`secretScopes` on the wire) (optional)

## `MCPEndpointCollectionPage`

- `data: list[kindgi.client.MCPEndpoint]`
- `next_cursor: str | None` (`nextCursor` on the wire) (optional)
- `has_more: bool` (`hasMore` on the wire)

## `MCPEndpointSecretRef`

The secret an MCP endpoint authenticates with: a name in the deployment's secrets store, resolved at the endpoint's tenant scope by the runtime (the shape webhooks and providers use). As the endpoint's own `secretRef`, it is sent as its bearer; inside `auth`, it is the scheme's password, client secret or header value. The endpoint keeps only this reference.

- `env_name: str` (`envName` on the wire)
- `name: str`

## `MCPHeaderAuth`

Headers of the server's own, each with a secret: an API key in `X-Api-Key`, a key and a secret in two headers, or `Authorization` with a prefix other than `Bearer `(`Token …`). The runtime resolves each `secretRef` when it connects, and refuses to follow a redirect with them, as it does for every `auth`.

- `scheme: Literal['header']`
- `headers: list[kindgi.client.MCPAuthHeader]`

## `MCPOAuth2ClientCredentialsAuth`

OAuth 2 client credentials: the runtime asks `tokenUrl` for an access token (`grant_type=client_credentials`) as `clientId`, with the client secret `secretRef` names, sends it as the endpoint's bearer, and asks for a new one before it expires (Drupal's Simple OAuth, for one). The token is never stored.

- `scheme: Literal['oauth2-client-credentials']`
- `token_url: AnyUrl` (`tokenUrl` on the wire)
- `client_id: str` (`clientId` on the wire)
- `secret_ref: kindgi.client.MCPEndpointSecretRef` (`secretRef` on the wire)
- `scope: str | None` (optional)
- `audience: str | None` (optional)
- `client_auth: Optional[Literal['client_secret_basic', 'client_secret_post']]` (`clientAuth` on the wire) (optional)

## `MCPPrompt`

- `name: str`
- `description: str | None` (optional)
- `arguments: list[kindgi.client.MCPPromptArgument] | None` (optional)

## `MCPPromptArgument`

- `name: str`
- `description: str | None` (optional)
- `required: bool | None` (optional)

## `MCPPromptCollection`

- `data: list[kindgi.client.MCPPrompt]`

## `MCPPromptMessage`

- `role: Literal['user', 'assistant']`
- `content: kindgi.client.Content2 | kindgi.client.Content3`

## `MCPResource`

- `uri: str`
- `name: str`
- `description: str | None` (optional)
- `mime_type: str | None` (`mimeType` on the wire) (optional)

## `MCPResourceCollection`

- `data: list[kindgi.client.MCPResource]`

## `MCPResourceContent`

- `uri: str`
- `mime_type: str | None` (`mimeType` on the wire) (optional)
- `text: str | None` (optional)
- `blob: str | None` (optional)

## `MemoryErasure`

- `id: uuid.UUID`
- `selector_kind: Literal['fact', 'participant', 'external', 'conversation']` (`selectorKind` on the wire)
- `selector: kindgi.client.MemoryErasureFactSelector | kindgi.client.MemoryErasureSubjectSelector | kindgi.client.MemoryErasureConversationSelector | None` (optional)
- `status: Literal['pending', 'running', 'waiting-on-run', 'completed', 'failed']`
- `phase: Literal['seed', 'expand', 'settle', 'erase', 'done']`
- `requested_by: str` (`requestedBy` on the wire)
- `matchable: bool`
- `counts: dict[str, CountsAdditionalProperty]`
- `attempts: int`
- `last_error: str | None` (`lastError` on the wire) (optional)
- `waiting_on: kindgi.client.WaitingOn | None` (`waitingOn` on the wire) (optional)
- `forced: Optional[Literal[True]]` (optional)
- `settle_rounds_capped: Optional[Literal[True]]` (`settleRoundsCapped` on the wire) (optional)
- `created_at: AwareDatetime` (`createdAt` on the wire)
- `started_at: AwareDatetime | None` (`startedAt` on the wire) (optional)
- `completed_at: AwareDatetime | None` (`completedAt` on the wire) (optional)
- `replayed_at: AwareDatetime | None` (`replayedAt` on the wire) (optional)

## `MemoryErasureConversationSelector`

One conversation.

- `conversation_id: str` (`conversationId` on the wire)

## `MemoryErasureCreated`

- `id: uuid.UUID`
- `selector_kind: Literal['fact', 'participant', 'external', 'conversation']` (`selectorKind` on the wire)
- `selector: kindgi.client.MemoryErasureFactSelector | kindgi.client.MemoryErasureSubjectSelector | kindgi.client.MemoryErasureConversationSelector | None` (optional)
- `status: Literal['pending', 'running', 'waiting-on-run', 'completed', 'failed']`
- `phase: Literal['seed', 'expand', 'settle', 'erase', 'done']`
- `requested_by: str` (`requestedBy` on the wire)
- `matchable: bool`
- `counts: dict[str, CountsAdditionalProperty]`
- `attempts: int`
- `last_error: str | None` (`lastError` on the wire) (optional)
- `waiting_on: kindgi.client.WaitingOn | None` (`waitingOn` on the wire) (optional)
- `forced: Optional[Literal[True]]` (optional)
- `settle_rounds_capped: Optional[Literal[True]]` (`settleRoundsCapped` on the wire) (optional)
- `created_at: AwareDatetime` (`createdAt` on the wire)
- `started_at: AwareDatetime | None` (`startedAt` on the wire) (optional)
- `completed_at: AwareDatetime | None` (`completedAt` on the wire) (optional)
- `replayed_at: AwareDatetime | None` (`replayedAt` on the wire) (optional)
- `warnings: list[kindgi.client.Warning1] | None` (optional)

## `MemoryErasureFactSelector`

One fact.

- `fact_id: str` (`factId` on the wire)

## `MemoryErasureLedger`

- `data: list[kindgi.client.MemoryErasureLedgerEntry]`

## `MemoryErasureLedgerEntry`

- `id: uuid.UUID`
- `selector_kind: Literal['fact', 'participant', 'external', 'conversation']` (`selectorKind` on the wire)
- `selector_hmac: str | None` (`selectorHmac` on the wire) (optional)
- `key_id: str | None` (`keyId` on the wire) (optional)
- `requested_by: str` (`requestedBy` on the wire)
- `status: Literal['pending', 'running', 'waiting-on-run', 'completed', 'failed']`
- `created_at: AwareDatetime` (`createdAt` on the wire)
- `completed_at: AwareDatetime | None` (`completedAt` on the wire) (optional)

## `MemoryErasurePage`

- `data: list[kindgi.client.MemoryErasure]`
- `has_more: bool` (`hasMore` on the wire)
- `next_cursor: str | None` (`nextCursor` on the wire) (optional)

## `MemoryErasureSubjectSelector`

A person: an app's end user (`participant`), or an `external` subject facts name. Erasing a Kindgi user isn't offered.

- `subject: kindgi.client.Subject`

## `Metadatum`

- `root: str`

## `Methods`

The ways in this deployment allows, for a sign-in page to show. Absent from older servers.

- `identity_providers: bool` (`identityProviders` on the wire)
- `api_token: bool` (`apiToken` on the wire)
- `session_cookie: Optional[Literal['secure', 'plain']]` (`sessionCookie` on the wire) (optional)
- `email_link: kindgi.client.EmailLink | None` (`emailLink` on the wire) (optional)

## `Metric`

- `name: Literal['weightedYesShare', 'judgedCoverage', 'weightedPrecisionAtK']`
- `k: int | None` (optional)
- `min_candidate: float | None` (`minCandidate` on the wire) (optional)
- `max_drop: float | None` (`maxDrop` on the wire) (optional)

## `Metrics`

- `weighted_yes_share: kindgi.client.ComparisonMetric` (`weightedYesShare` on the wire)
- `judged_coverage: kindgi.client.ComparisonMetric` (`judgedCoverage` on the wire)
- `weighted_precision_at_k: kindgi.client.ComparisonMetric` (`weightedPrecisionAtK` on the wire)

## `MintPublicRunTokenBody`

- `run_ids: list[kindgi.client.RunId]` (`runIds` on the wire)
- `expires_in_seconds: int | None` (`expiresInSeconds` on the wire) (optional)

## `MintPublicRunTokenResult`

- `token: str`
- `expires_at: AwareDatetime` (`expiresAt` on the wire)
- `run_ids: list[str]` (`runIds` on the wire)

## `MintSystemKeyBody`

- `scopes: list[Literal['system:tenants', 'system:tenants:create', 'system:tenants:image-prefix', 'system:tenants:production', 'system:tenants:limits', 'system:tenants:contacts', 'system:tenants:purge', 'system:suspend', 'system:deployments', 'system:license', 'kindgi:system']]`
- `label: str | None` (optional)
- `expires_at: AwareDatetime | None` (`expiresAt` on the wire) (optional)

## `MintSystemKeyResult`

The new system key, plus its secret.

- `id: str`
- `label: str | None` (optional)
- `scopes: list[Literal['system:tenants', 'system:tenants:create', 'system:tenants:image-prefix', 'system:tenants:production', 'system:tenants:limits', 'system:tenants:contacts', 'system:tenants:purge', 'system:suspend', 'system:deployments', 'system:license', 'kindgi:system']]`
- `created_at: AwareDatetime` (`createdAt` on the wire)
- `expires_at: AwareDatetime | None` (`expiresAt` on the wire) (optional)
- `revoked_at: AwareDatetime | None` (`revokedAt` on the wire) (optional)
- `minted_by: str` (`mintedBy` on the wire)
- `token: str`

## `MintTokenBody`

A new API key. `for` is whom it acts for: the caller by default; only a tenant admin mints for someone else.

- `for_: kindgi.client.ApiKeyPrincipal | None` (`for` on the wire) (optional)
- `role: Optional[Literal['admin', 'member']]` (optional)
- `capabilities: list[kindgi.client.Capability] | None` (optional)
- `label: str | None` (optional)
- `expires_at: AwareDatetime | None` (`expiresAt` on the wire) (optional)
- `project_id: uuid.UUID | None` (`projectId` on the wire) (optional)

## `MintTokenResult`

The new key, plus its secret.

- `token_id: uuid.UUID` (`tokenId` on the wire)
- `principal: kindgi.client.ApiKeyPrincipal | None` (optional)
- `role: Literal['admin', 'member']`
- `capabilities: list[kindgi.client.Capability]`
- `label: str | None` (optional)
- `project_id: uuid.UUID | None` (`projectId` on the wire) (optional)
- `created_by: str | None` (`createdBy` on the wire) (optional)
- `created_at: AwareDatetime` (`createdAt` on the wire)
- `expires_at: AwareDatetime | None` (`expiresAt` on the wire) (optional)
- `revoked_at: AwareDatetime | None` (`revokedAt` on the wire) (optional)
- `last_used_at: AwareDatetime | None` (`lastUsedAt` on the wire) (optional)
- `token: str`

## `Model`

For a drafter that used a model: which.

- `provider_id: str` (`providerId` on the wire)
- `model: str`

## `Model1`

For a prompt pass: the provider and model that drafts the templates.

- `provider_id: str` (`providerId` on the wire)
- `model: str`

## `Model2`

For a prompt pass: the tenant's provider and model that drafts the templates.

- `provider_id: str` (`providerId` on the wire)
- `model: str`

## `Model3`

- `provider_id: str` (`providerId` on the wire)
- `model: str`
- `runs: int`

## `Model4`

- `provider_id: str` (`providerId` on the wire)
- `model: str`

## `ModelCallError`

Why a model call failed (`status: failed`).

- `message: str`

## `ModelCallTokens`

The call's tokens. `promptTokens` / `completionTokens` are the totals; `cacheReadTokens` / `cacheWriteTokens` are parts of `promptTokens`, `reasoningTokens` of `completionTokens`, present when the provider reports them.

- `prompt_tokens: int` (`promptTokens` on the wire)
- `completion_tokens: int` (`completionTokens` on the wire)
- `cache_read_tokens: int | None` (`cacheReadTokens` on the wire) (optional)
- `cache_write_tokens: int | None` (`cacheWriteTokens` on the wire) (optional)
- `reasoning_tokens: int | None` (`reasoningTokens` on the wire) (optional)

## `ModelInfo`

- `name: str`
- `context_window: int` (`contextWindow` on the wire)
- `features: list[Literal['structured-output', 'vision', 'audio-input', 'audio-output', 'tool-use', 'parallel-tool-use', 'thinking', 'long-context', 'code-execution', 'web-search', 'file-search', 'streaming', 'batch']]`
- `cost: kindgi.client.ProviderCost`
- `p95_latency_ms: float | None` (`p95LatencyMs` on the wire) (optional)
- `max_output_tokens: int | None` (`maxOutputTokens` on the wire) (optional)
- `sampling: bool | None` (optional)
- `thinking: kindgi.client.ModelThinking | None` (optional)
- `description: str | None` (optional)

## `ModelThinking`

How the model thinks before it answers, so a call that wants as little as it allows (a judge's) gets it. Absent: it doesn't think, or nothing is known.

- `mode: Literal['adaptive', 'always']`
- `lowest: str`

## `MyKeyLimits`

The caller's API key, when it is one, and what it limits.

- `token_id: str` (`tokenId` on the wire)
- `role: Optional[Literal['admin', 'member']]` (optional)
- `project_id: str | None` (`projectId` on the wire) (optional)

## `MyOrgAccess`

- `org_id: str` (`orgId` on the wire)
- `name: str`
- `role: Literal['admin', 'member']`

## `MyPermissions`

What the caller may do, with its API key's limits applied: tenant admin and member, its reviewer role, its key's limits and capabilities, the projects it may read with its role in each and how it holds it, its orgs and teams, and what each project role allows. Only what the caller may see: nothing names a project it can't read, or anyone else's role.

- `tenant_id: uuid.UUID` (`tenantId` on the wire)
- `tenant: kindgi.client.MyTenantAccess`
- `reviewer: kindgi.client.MyReviewerAccess | None` (optional)
- `key: kindgi.client.MyKeyLimits | None` (optional)
- `token_capabilities: list[str]` (`tokenCapabilities` on the wire)
- `projects: list[kindgi.client.MyProjectAccess]`
- `orgs: list[kindgi.client.MyOrgAccess]`
- `teams: list[kindgi.client.MyTeamAccess]`
- `capabilities: kindgi.client.RoleCapabilities`
- `read_only_notice: str | None` (`readOnlyNotice` on the wire) (optional)

## `MyProjectAccess`

- `project_id: str` (`projectId` on the wire)
- `name: str`
- `role: Literal['owner', 'admin', 'editor', 'viewer']`
- `via: list[Annotated[kindgi.client.AccessPathDirect | kindgi.client.AccessPathTeam | kindgi.client.AccessPathOrgAdmin | kindgi.client.AccessPathTenantAdmin, FieldInfo(annotation=NoneType, required=True, discriminator='kind')]]`

## `MyReviewerAccess`

- `role: Literal['standard', 'senior', 'admin']`
- `id: str | None` (optional)
- `decides: list[Literal['standard', 'senior', 'admin']]`
- `can_decide: bool` (`canDecide` on the wire)

## `MyTeamAccess`

- `team_id: str` (`teamId` on the wire)
- `name: str`
- `role: Literal['member', 'admin']`

## `MyTenantAccess`

- `admin: bool`
- `member: bool | None` (optional)
