Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Run the tool cost check when an MCP server script that shapes tool results changes

Nguyen Xuan Anca149c9fa1a1
diff --git a/scripts/preflight.mjs b/scripts/preflight.mjs
index fe3ef705..f8af1f4f 100644
--- a/scripts/preflight.mjs
+++ b/scripts/preflight.mjs
@@ -24,7 +24,7 @@ export const PROTECTED_FILES = Object.freeze({
const userFacingPattern = /^(src|bin|packages|skills)\//;
const shippedCodePattern = /^(src|bin|packages)\/|^package(-lock)?\.json$|^vite\.lib\.config\.js$|^scripts\/build-mcp\.mjs$/;
-const toolCodePattern = /^(src\/agent-|src\/mcp|bin\/)|^scripts\/(build-mcp|measure-tool-cost|check-tool-cost)/;
+const toolCodePattern = /^(src\/agent-|src\/mcp|bin\/)|^scripts\/(build-mcp|measure-tool-cost|check-tool-cost|mcp-server|mcp-input-errors|capabilities-topics|tool-examples)/;
const linkedTextPattern = /\.(md|html)$/;
// Checks a GPU or a person's eyes must run. CONTRIBUTING.md lists them; these patterns only point out the ones that may apply.
diff --git a/tests/preflight.test.js b/tests/preflight.test.js
index 2749a52d..a9a7f196 100644
--- a/tests/preflight.test.js
+++ b/tests/preflight.test.js
@@ -40,6 +40,12 @@ test('MCP tool code runs the schema and tool cost checks', () => {
assert.equal(checkNamed(checks, 'tool cost').skipped, null);
});
+test('the MCP server scripts that shape tool results run the tool cost check', () => {
+ for (const path of ['scripts/capabilities-topics.mjs', 'scripts/mcp-server.mjs', 'scripts/tool-examples.mjs']) {
+ assert.equal(checkNamed(planChecks([path, 'changes/700.md']), 'tool cost').skipped, null, path);
+ }
+});
+
test('--skip-tests skips the build, the tests and the coverage gate', () => {
const checks = planChecks(['src/camera.js'], { skipTests: true });
for (const name of ['build library', 'unit tests and coverage', 'coverage gate']) {