intellicrack.mcp.progress

Progress a server reports on a request that is still running.

A client asks for progress by giving a request a progressToken in its _meta; the server answers with notifications/progress carrying the token, how far it has got, optionally the total, and optionally a message. Intellicrack asks for it on every tool call, resource read and prompt fetch, on both protocol generations, and hands each notice on as an McpProgress.

The message is the server’s own text, so it is cleaned of hidden characters and forged fence markers and bounded before anything shows it. Whether a notice counts as progress for the request’s deadline is decided by the connection: only a value above the last one does, as the protocol requires progress to increase.

PROGRESS_MESSAGE_LIMIT: Final[int] = 300

The most characters of a server’s progress message that are kept.

class ProgressKind[source]

Bases: StrEnum

Which kind of request the progress is for.

Variables:
  • TOOL – A tools/call.

  • RESOURCE – A resources/read.

  • PROMPT – A prompts/get.

TOOL = 'tool'
RESOURCE = 'resource'
PROMPT = 'prompt'
__new__(value)
class McpProgress[source]

Bases: object

One progress notice from a server.

Variables:
  • server_id (str) – The server reporting.

  • kind (ProgressKind) – The kind of request.

  • subject (str) – The tool’s name, the resource’s URI or the prompt’s name.

  • progress (float) – How far the server has got.

  • total (float | None) – The total it is working towards, or None when unknown.

  • message (str | None) – What the server said about it, cleaned, or None.

server_id: str
kind: ProgressKind
subject: str
progress: float
total: float | None
message: str | None
classmethod from_wire(server_id, kind, subject, *, progress, total, message)[source]

Build a notice from what the server sent, cleaning its text.

Parameters:
  • server_id (str) – The server reporting.

  • kind (ProgressKind) – The kind of request.

  • subject (str) – What the request is for.

  • progress (float) – How far the server has got.

  • total (float | None) – Its total, or None.

  • message (str | None) – Its message, or None.

Returns:

The notice, its message cleaned and bounded and a total that is not a positive finite number dropped.

Return type:

McpProgress

property fraction: float | None

How much of the total is done.

Returns:

A value from 0 to 1, or None when the total is unknown.

Return type:

float | None

describe()[source]

Render the notice for the operator.

Returns:

How far the server has got, out of what total, and what it said, such as 3/10: indexing sections.

Return type:

str

__init__(server_id, kind, subject, progress, total=None, message=None)
Parameters:
Return type:

None

type ProgressFn = Callable[[McpProgress], None]

Receives each progress notice for one request.