RetrievedChunk#

class scikitplot.mcp.RetrievedChunk(text, source_uri, score=0.0, doc_id='', title='', anchor='', extra=<factory>)[source]#

One retrieved passage with the metadata needed to cite it.

This is the boundary type between retrieval (corpus / annoy) and the MCP tool layer. A concrete retriever maps its native result (e.g. a scikitplot.corpus.SearchResult / CorpusDocument or a scikitplot.annoy neighbour) onto this shape.

Parameters:
textstr

The passage text. Treated as untrusted; truncated and control-stripped before entering a tool result.

source_uristr

Where the passage came from (page URL or path). Used to build the citation link; validated to an http(s)/relative scheme.

scorefloat

Retrieval score (higher = more relevant). Used for ordering only.

doc_idstr, optional

Stable identifier of the chunk (for resources/read follow-ups).

titlestr, optional

Human-readable source title (e.g. page or section heading).

anchorstr, optional

In-page anchor / section id so the citation deep-links to the section.

Parameters:
anchor: str = ''#
doc_id: str = ''#
extra: dict[str, Any][source]#
score: float = 0.0#
source_uri: str[source]#
text: str[source]#
title: str = ''#