Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/35036-mcp-door-tool-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@objectstack/spec': patch
'@objectstack/lint': patch
---

fix(lint): `ai-skill-tool-unresolved` resolves every tool the MCP door registers for a skill offered over MCP, and says why when a skill kept out of MCP names one

Clause-②: yes (widening) — `ai-skill-tool-unresolved` stops warning on eight tool names the MCP door registers, and `@objectstack/spec/system` gains the export `MCP_DOOR_TOOL_NAMES`; nothing that resolved before is reported
Metadata-protocol: none

The MCP door in `@objectstack/mcp` registers record, file, action, federation and dataset tools, and offers a skill bound to them over MCP. The lint rule knew only the two file tools, so a skill bound to `aggregate_records`, `delete_record`, `delete_records`, `list_actions`, `run_action`, `resume_run`, `list_remote_tables` or `import_object` was warned that the agent cannot call it, and `os lint --strict` failed.

`@objectstack/spec/system` now exports `MCP_DOOR_TOOL_NAMES`, every tool the door registers on a bridge carrying every optional member under a grant naming every scope. For a skill offered over MCP (`mcpPrompt` not `false`), the rule resolves every name in it. `@objectstack/mcp` has a test that keeps this list equal to what the door registers, so a tool added to or renamed at the door fails there until the list follows it. Some door names (`get_record`, `query_records`, `describe_object`, …) are cloud registrations as well and stay in `PLATFORM_PROVIDED_TOOL_NAMES`; the door's names do not join `PLATFORM_TOOLS_BY_PACKAGE`, so each group there stays the exact set one cloud package registers. `MCP_FILE_TOOL_NAMES` stays as it was and is part of the new list.

A skill kept out of MCP (`mcpPrompt: false`) runs only in the in-product agents, which do not have the door tools no cloud package registers, so naming one there is still reported. The warning now says so: "Tool "run_action" resolves only for a skill offered over MCP, and this skill sets `mcpPrompt: false`, so the in-product agents it runs in have no such tool". The fix line offers dropping `mcpPrompt: false` or removing the name. A trailing-wildcard entry that matches only door tools gets the same verdict.

`os explain ai-skill-tool-unresolved` names `MCP_DOOR_TOOL_NAMES` as the third source and adds that a skill which runs an app action binds `action_<name>` (or `action_*`) rather than `run_action`: the MCP door serves that entry through `run_action`, and the in-product agents call the action tool itself.
2 changes: 1 addition & 1 deletion packages/lint/src/reference-integrity-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ export const REFERENCE_INTEGRITY_RULES: readonly ReferenceIntegrityRule[] = [
// `collectToolUniverse` unions `PLATFORM_PROVIDED_TOOL_NAMES` ∪
// `stack.tools` ∪ the materialised action family from `stack.actions` and
// every object's `actions`, and a skill offered over MCP (`mcpPrompt` not
// `false`) also resolves `MCP_FILE_TOOL_NAMES`, the door's file tools. A
// `false`) also resolves `MCP_DOOR_TOOL_NAMES`, the door's own tools. A
// per-write snapshot carries `objects` — so an
// object-level `action_<name>` resolves — but NEITHER `tools` NOR `actions`,
// and no snapshot can carry a tool a runtime plugin registers. So at this
Expand Down
13 changes: 8 additions & 5 deletions packages/lint/src/rule-explanations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5559,10 +5559,11 @@ const AI_SKILL_TOOL_UNRESOLVED_EXPLANATION: RuleExplanation = {
// The four sources and the wildcard are held to the rule by its test, each one silencing it.
'A `skill.tools` entry resolves, in order, against the stack\'s own `stack.tools` names; ' +
'`PLATFORM_PROVIDED_TOOL_NAMES` (`@objectstack/spec/system`), the tools the cloud AI runtime ' +
'registers at boot; `MCP_FILE_TOOL_NAMES` (same module), the file tools the MCP door registers ' +
'(`read_file`, `create_upload_link`), only for a skill offered over MCP: no cloud package ' +
'registers either, so an in-product turn runs without them, and a skill kept out of MCP ' +
'(`mcpPrompt: false`) is still reported for naming them; and the materialised action tools, ' +
'registers at boot; `MCP_DOOR_TOOL_NAMES` (same module), every tool the MCP door registers ' +
'(its record, file, action, federation and dataset tools), only for a skill offered over MCP: ' +
'a door tool no cloud package registers, such as `run_action` or `read_file`, is absent from an ' +
'in-product turn, so a skill kept out of MCP (`mcpPrompt: false`) is still reported for naming ' +
'one, by a verdict that says the name resolves over MCP only; and the materialised action tools, ' +
'one `action_<name>` per declarative action in `stack.actions` or any object\'s `actions` ' +
'(ADR-0109: the default path declares no tool record at all). A trailing-wildcard entry ' +
'(`action_*`, `crm_*`) resolves when any member of that universe starts with its prefix.',
Expand All @@ -5580,7 +5581,9 @@ const AI_SKILL_TOOL_UNRESOLVED_EXPLANATION: RuleExplanation = {
'Family prefixes materialised by the runtime: action_. A materialised tool needs no tool record ' +
'(the ADR-0109 default path), so backing a name means declaring the action, or referencing a ' +
'platform tool by its registered name; otherwise remove the name and the instructions that mention ' +
'it. Ignore the warning only if a runtime plugin outside the platform registry provides the name.',
'it. To run an app action, bind `action_<name>` (or `action_*`) rather than `run_action`: the MCP ' +
'door serves that entry through `run_action`, and the in-product agents call the action tool itself. ' +
'Ignore the warning only if a runtime plugin outside the platform registry provides the name.',
'The runtime drops an unresolved name without a word, so the skill\'s instructions promise a ' +
'capability the agent cannot call, and the assistant improvises or fails when asked to use it. ' +
'A warning, not an error (ADR-0078\'s advisory-first ratchet): a runtime plugin outside the ' +
Expand Down
95 changes: 83 additions & 12 deletions packages/lint/src/validate-ai-tool-references.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import {
validateAiToolReferences as validateAiToolReferencesUnrecorded,
AI_SKILL_TOOL_UNRESOLVED,
} from './validate-ai-tool-references.js';
import { MCP_FILE_TOOL_NAMES, PLATFORM_TOOL_FAMILY_PREFIXES } from '@objectstack/spec/system';
import {
MCP_DOOR_TOOL_NAMES,
MCP_FILE_TOOL_NAMES,
PLATFORM_PROVIDED_TOOL_NAMES,
PLATFORM_TOOL_FAMILY_PREFIXES,
} from '@objectstack/spec/system';
import { explainRule } from './rule-explanations.js';

// [#22161] Each finding is one verdict sentence; the reasoning it used to
Expand Down Expand Up @@ -57,12 +62,12 @@ describe('validate-ai-tool-references', () => {
]);
});

it('checks the tools of a skill its owner keeps out of MCP (mcpPrompt: false) exactly as without the key, the MCP file tools aside (#34167)', () => {
it('checks the tools of a skill its owner keeps out of MCP (mcpPrompt: false) exactly as without the key, the MCP door tools aside (#34167)', () => {
// The opt-out narrows MCP prompt projection: the binding is still the
// in-product agent's tool set, and still checked in both distributions.
// Its one effect on this rule is the MCP file tools, which resolve only for
// a skill offered over MCP (the #34948 control below); this fixture names
// none of them.
// Its one effect on this rule is the MCP door's tools, which resolve only
// for a skill offered over MCP (the #34948 and #35036 controls below); this
// fixture names none the door alone serves.
const stack = (mcpPrompt?: boolean) => ({
skills: [
{
Expand Down Expand Up @@ -249,15 +254,17 @@ describe('validate-ai-tool-references', () => {
* [#34948] The MCP door's file pair. `@objectstack/mcp` registers `read_file`
* and `create_upload_link` and offers a skill bound to them over MCP, but no
* cloud package registers either, so they are not in the cloud registry: the
* rule reads them from `MCP_FILE_TOOL_NAMES`. While it did not, a skill bound
* to the tools it uses failed `os lint --strict`.
* rule reads them from the door's list (`MCP_FILE_TOOL_NAMES`, now a part of
* `MCP_DOOR_TOOL_NAMES`). While it did not, a skill bound to the tools it
* uses failed `os lint --strict`.
*/
it('resolves the MCP door\'s file tools, read_file and create_upload_link (#34948)', () => {
const two = ['read_file', 'create_upload_link'];
expect(validateAiToolReferences({ skills: [{ name: 'receipts', tools: two }] })).toEqual([]);
// The list the rule reads is the one the door's conformance test holds
// equal to what it registers.
// The lists the door's conformance tests hold equal to what it registers:
// the file pair, inside the door's whole set, which the rule reads.
expect([...MCP_FILE_TOOL_NAMES].sort()).toEqual([...two].sort());
expect(MCP_DOOR_TOOL_NAMES).toEqual(expect.arrayContaining(two));

// The control: a third name shaped like the two and registered by nobody
// is still reported, so this pin fails on a universe widened too far.
Expand All @@ -283,6 +290,8 @@ describe('validate-ai-tool-references', () => {
expect(findings).toHaveLength(1);
expect(findings[0].path).toBe('skills[0].tools[0]');
expect(findings[0].message).toContain('"read_file"');
// [#35036] The verdict says why: the name resolves over MCP only.
expect(findings[0].message).toContain('resolves only for a skill offered over MCP');
// The same skill with the key absent, or `true`, is offered over MCP and
// resolves: the verdict follows `mcpPrompt` and nothing else.
expect(validateAiToolReferences({ skills: [{ name: 'receipts', tools: ['read_file'] }] })).toEqual([]);
Expand All @@ -291,6 +300,64 @@ describe('validate-ai-tool-references', () => {
).toEqual([]);
});

/**
* [#35036] Every other tool the MCP door registers. The door serves the
* record, action, federation and dataset tools as well as the file pair, and
* a skill offered over MCP is offered where they are listed, but the rule
* read only the file pair: a skill bound to `run_action` or
* `aggregate_records` failed `os lint --strict` for naming a served tool.
* The rule reads `MCP_DOOR_TOOL_NAMES`, which `@objectstack/mcp` holds equal
* to what the door registers.
*/
it('resolves every tool the MCP door registers for a skill offered over MCP (#35036)', () => {
const eight = [
'aggregate_records', 'delete_record', 'delete_records', 'list_actions',
'run_action', 'resume_run', 'list_remote_tables', 'import_object',
];
// None of the eight is a cloud registration: each resolved from nowhere before.
for (const name of eight) expect(PLATFORM_PROVIDED_TOOL_NAMES.has(name), name).toBe(false);
expect(validateAiToolReferences({ skills: [{ name: 'ops', tools: eight }] })).toEqual([]);
expect(validateAiToolReferences({ skills: [{ name: 'ops', tools: [...MCP_DOOR_TOOL_NAMES] }] })).toEqual([]);
// A family the door alone serves resolves too.
expect(validateAiToolReferences({ skills: [{ name: 'ops', tools: ['resume_*'] }] })).toEqual([]);

// The control: a name shaped like the door's and registered by nobody is
// still reported, so this pin fails on a universe widened too far.
const control = validateAiToolReferences({ skills: [{ name: 'ops', tools: [...eight, 'run_actions'] }] });
expect(control).toHaveLength(1);
expect(control[0].path).toBe('skills[0].tools[8]');
expect(control[0].message).toContain('"run_actions" resolves to no stack, platform or materialised action tool');
});

/**
* [#35036] On a skill its owner keeps out of MCP (`mcpPrompt: false`), a
* name only the door serves is still reported, since the in-product agents
* the skill runs in have no such tool, and the verdict says the name
* resolves over MCP only instead of calling it fictional. A door name a
* cloud package registers too resolves there as before.
*/
it('reports a door-only name on a mcpPrompt: false skill with a verdict that says it resolves over MCP only (#35036)', () => {
const findings = validateAiToolReferences({
skills: [{
name: 'ops',
mcpPrompt: false,
tools: ['get_record', 'run_action', 'resume_*', 'nope_tool'],
}],
});
expect(findings.map((f) => f.path)).toEqual(['skills[0].tools[1]', 'skills[0].tools[2]', 'skills[0].tools[3]']);
expect(findings[0].message).toBe(
'Tool "run_action" resolves only for a skill offered over MCP, and this skill sets `mcpPrompt: false`, '
+ 'so the in-product agents it runs in have no such tool',
);
expect(findings[0].hint).toBe(
'Drop `mcpPrompt: false` if the skill is written for MCP clients, or remove "run_action" and the '
+ 'instructions that mention it',
);
expect(findings[1].message).toMatch(/^Tool family "resume_\*" resolves only for a skill offered over MCP/);
// The control: a name nobody registers keeps the fictional-name verdict.
expect(findings[2].message).toContain('"nope_tool" resolves to no stack, platform or materialised action tool');
});

/**
* The chat's confirmed record write (cloud#3565; it replaced cloud#3383's
* `draft_record`): a skill naming `create_record` / `update_record` resolves;
Expand Down Expand Up @@ -414,8 +481,10 @@ describe('[#22161] one-line verdicts — ai-skill-tool-unresolved', () => {
for (const fact of [
'`stack.tools`',
'`PLATFORM_PROVIDED_TOOL_NAMES`',
'`MCP_FILE_TOOL_NAMES`',
'`MCP_DOOR_TOOL_NAMES`',
'only for a skill offered over MCP',
'by a verdict that says the name resolves over MCP only',
'bind `action_<name>` (or `action_*`) rather than `run_action`',
'`mcpPrompt: false`',
'`stack.actions` or any object\'s `actions`',
'trailing-wildcard',
Expand Down Expand Up @@ -451,7 +520,8 @@ describe('[#22161] one-line verdicts — ai-skill-tool-unresolved', () => {

it('every verdict the cases in this file fired is one line of at most 200 characters', () => {
const converted = fired.filter((f) => f.rule === AI_SKILL_TOOL_UNRESOLVED);
// The coverage control first: all three arms fired.
// The coverage control first: all four arms fired.
expect(converted.some((f) => f.message.includes('resolves only for a skill offered over MCP'))).toBe(true);
expect(converted.some((f) => f.message.startsWith('Tool family '))).toBe(true);
expect(converted.some((f) => f.message.includes('does not become an AI tool'))).toBe(true);
expect(converted.some((f) => f.message.includes('resolves to no stack, platform or materialised action tool'))).toBe(true);
Expand All @@ -468,7 +538,8 @@ describe('[#22161] one-line verdicts — ai-skill-tool-unresolved', () => {
describe('[#22161] one-line fixes — ai-skill-tool-unresolved', () => {
it('every `fix:` line the cases in this file fired is one line of at most 200 characters', () => {
const converted = fired.filter((f) => f.rule === AI_SKILL_TOOL_UNRESOLVED);
// Coverage control: the opt-in arm and the back-it arm both fired.
// Coverage control: the MCP-only, opt-in and back-it arms all fired.
expect(converted.some((f) => f.hint.startsWith('Drop `mcpPrompt: false`'))).toBe(true);
expect(converted.some((f) => f.hint.startsWith('Opt "'))).toBe(true);
expect(converted.some((f) => f.hint.startsWith('Back "'))).toBe(true);
for (const f of converted) {
Expand Down
Loading
Loading