//! The tool surface, primitive by primitive — the compiled form of "every//! primitive gets its full verb set".//!//! For every primitive kind, the five standard verbs, each SATISFIED by a//! named tool or REFUSED with a written reason. The grid itself is `surface`//! (design S5), because it is data the TypeScript owns; what lives here is its//! shape, its readers, and the gates.//!//! A model reading `create_todo` assumes `update_todo` exists; a hole in this//! grid is a hallucinated tool call in somebody's session. That is why the grid//! is product surface, not bookkeeping — and why the four invariants of//! `toolSurface.test.ts` are unit tests here rather than prose.use std::collections::HashSet;pubusecrate::mcp::surface::{ DEV_TOOLS, GET_RECORD_KINDS, PRIMITIVE_KINDS, SHARED_TOOLS, TOOL_SURFACE,};/// A verb satisfied by a tool, or refused for a written reason.#[derive(Debug, Clone, Copy, PartialEq, Eq)]pubenumVerbCell {Tool(&'static str),Not(&'static str),}implVerbCell {pubfn tool(&self) -> Option<&'static str> {matchself {VerbCell::Tool(name) => Some(name),VerbCell::Not(_) => None, } }pubfn refusal(&self) -> Option<&'static str> {matchself {VerbCell::Tool(_) => None,VerbCell::Not(reason) => Some(reason), } }}/// The five verbs, plus whatever else a primitive owns.#[derive(Debug, Clone, Copy, PartialEq, Eq)]pubstructVerbSet {/// Bring one into existence.pub create: VerbCell,/// Browse them directly (`search_records` is the cross-kind finder).pub list: VerbCell,/// Expand one by id.pub get: VerbCell,/// Change one in place.pub update: VerbCell,/// Take one out of the working set — delete, archive, or refuse.pub remove: VerbCell,/// Tools of this primitive beyond the five verbs.pub also: &'static [&'static str],}implVerbSet {/// The five cells in the order the grid declares them.pubfn verbs(&self) -> [(&'static str, VerbCell); 5] { [ ("create", self.create), ("list", self.list), ("get", self.get), ("update", self.update), ("remove", self.remove), ] }}pubfn verb_set(kind: &str) -> Option<&'staticVerbSet> { TOOL_SURFACE .iter() .find(|(name, _)| *name == kind) .map(|(_, row)| row)}/// The tools a primitive's row names that are not shared facilities.pubfn owned_tools(kind: &str) -> Vec<&'static str> {letSome(row) = verb_set(kind) else {returnVec::new(); };let shared: HashSet<&str> = SHARED_TOOLS.iter().copied().collect();letmut seen: Vec<&'static str> = Vec::new();for (_, cell) in row.verbs() {ifletSome(tool) = cell.tool() {if !seen.contains(&tool) { seen.push(tool); } } }for extra in row.also {if !seen.contains(extra) { seen.push(extra); } } seen.into_iter().filter(|tool| !shared.contains(tool)).collect()}#[cfg(test)]#[path = "tool_surface_tests.rs"]mod tests;