feat(mcp): one check of every write tool's text for a tax id, from a table of its strings
Every string a write tool takes (423 across 78 tools) is classed in text_fields::TABLE: 127 free text (refused when it looks like a tax id), 27 party fields (refused at any run of nine digits, as the engine does), and 269 exempt for a named reason (vault input, lookup key, id, amount, date, vocabulary, last four digits, bank pattern, link, a structured value the engine reads). The check runs in call_tool before the tool or any write, for previews too, and a refused call writes nothing (WB-format-10). A test fails when a write tool has a string the table does not class, or the table names one no tool takes. A string the table does not know is free text. Annotations on a receipt (payee, source, note ...) meet the engine's check as well. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
548901ce7d
commit
7327d04897
6 files changed
+1379
-1
No files matched your search
@@ -1588,6 +1588,8 @@ mod next_steps;
|
||||
mod projects;
|
||||
#[path = "tools/prompts.rs"]
|
||||
mod prompts;
|
||||
#[path = "text_fields.rs"]
|
||||
mod text_fields;
|
||||
pub use kept::SettingKeyOut;
|
||||
|
||||
// The tool groups: one file each (plan/served.md 8.2 U0a). A unit adds a
|
||||
@@ -1934,6 +1936,15 @@ impl ServerHandler for BooksServer {
|
||||
}
|
||||
calls::key_problem(request_key.as_ref())
|
||||
.map(|why| (calls::MISSING_KEY, Ok(tool_error(why))))
|
||||
})
|
||||
// A string that looks like a tax id isn't run, whatever it was for:
|
||||
// the vault is where one goes (text_fields.rs INVARIANT 5).
|
||||
.or_else(|| {
|
||||
if !calls::writes(&request.name) {
|
||||
return None;
|
||||
}
|
||||
text_fields::refusal(&request.name, request.arguments.as_ref())
|
||||
.map(|why| (access::TIN_IN_TEXT, Ok(tool_error(why))))
|
||||
});
|
||||
if let Some((code, answer)) = refusal {
|
||||
call.digested(refused_digest(request.arguments.clone()).await);
|
||||
|
||||
Reference in new issue
Block a user