pub struct McpTools<'a> {
pub state: &'a AppState,
pub me: &'a Actor,
pub tainted: AtomicBool,
pub log: AccessCtx,
pub origin: Origin,
}Expand description
The MCP tools with the rights of me. A run takes minutes, so every
call uses the user’s rights as they are at that moment (a membership
lost or a group restricted during the run applies to the next step).
Confused deputy: text that other users typed (request comments, names, notes) reaches the model and may tell it to copy restricted content into a comment or a draft that those users can read. So once a read in this run returned something a reader without the user’s restricted groups would not have got (or a write returned such an object, e.g. a draft with restricted dependencies), the text write tools refuse for the rest of the run.
Fields§
§state: &'a AppState§me: &'a Actor§tainted: AtomicBoolA read returned restricted content (see above).
log: AccessCtxChannel (assistant) and client address for the read log of need-to-know groups.
origin: OriginThe request the run serves: its conditions on membership apply to
every step again (see McpTools::with_origin).
Implementations§
Source§impl<'a> McpTools<'a>
impl<'a> McpTools<'a>
pub fn new(state: &'a AppState, me: &'a Actor) -> McpTools<'a>
Sourcepub fn with_origin(self, origin: Origin) -> McpTools<'a>
pub fn with_origin(self, origin: Origin) -> McpTools<'a>
The same tools for a request: its client address goes into the read log, and each step hides the groups whose network or session-age condition the request does not meet (and, for a request with a personal access token, the groups that switched tokens off).
Sourcepub async fn note_context(&self, question: &Question)
pub async fn note_context(&self, question: &Question)
The page the question was asked on reaches the model in the first message, not through a tool: an item or change order the outsider may not see taints the run from the start (its number would otherwise be free to copy into a public text).
Sourcepub async fn note_page(&self, page: &PageContext)
pub async fn note_page(&self, page: &PageContext)
The resolved page context reaches the model in the first message too (the selected row, the rows shown, a project group, a change request): if somebody outside the user’s restricted groups would get a different context from the same hint, the run starts tainted.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for McpTools<'a>
impl<'a> !RefUnwindSafe for McpTools<'a>
impl<'a> !UnwindSafe for McpTools<'a>
impl<'a> Send for McpTools<'a>
impl<'a> Sync for McpTools<'a>
impl<'a> Unpin for McpTools<'a>
impl<'a> UnsafeUnpin for McpTools<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> Parallelizable for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.