Kantoor.MCP.Interface (Kantoor v1.0.0)

The caller of one MCP request: the person behind the OAuth token, the token's scopes, and the client that approved it. Every operation goes through here, which checks the scopes and the person's role, applies the installation's switch and tool groups, runs the same context function the web interface uses, and audits the call.

The interface is also the single place a destructive operation becomes a dry run: without confirm: true nothing is dispatched, and the answer says what the call would have done.

Summary

Functions

Whether the identity may run entry at all.

Runs one tool. Returns {:ok, data, meta} or {:error, sentence}; every outcome is audited.

A sentence for an error returned by a context function.

Builds the interface for an authenticated request.

Why the identity may not run entry, or nil when it may.

The scope's id for the audit, when a caller needs it.

The person's id.

Types

t()

@type t() :: %Kantoor.MCP.Interface{
  client: term(),
  scope: term(),
  scopes: term(),
  token: term()
}

Functions

allowed?(interface, entry)

@spec allowed?(t() | nil, Kantoor.MCP.Entry.t()) :: boolean()

Whether the identity may run entry at all.

execute(interface, name, arguments)

@spec execute(t(), String.t(), map() | nil) ::
  {:ok, term(), map()} | {:error, String.t()}

Runs one tool. Returns {:ok, data, meta} or {:error, sentence}; every outcome is audited.

human(changeset)

A sentence for an error returned by a context function.

new(token, client, scope, scopes)

Builds the interface for an authenticated request.

refusal(interface, entry)

@spec refusal(t() | nil, Kantoor.MCP.Entry.t()) :: String.t() | nil

Why the identity may not run entry, or nil when it may.

scope(interface)

The scope's id for the audit, when a caller needs it.

user_id(arg1)

The person's id.