GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcpx: argument rules -- allow a call by its arguments, per tool and per argument (JSON Schema; depends on #254) · Issue #1986 · developing-today/code

mcpx: argument rules -- allow a call by its arguments, per tool and per argument (JSON Schema; depends on #254) #1986

New issue
Copy link
New issue
Copy link
Closed
Closed
mcpx: argument rules -- allow a call by its arguments, per tool and per argument (JSON Schema; depends on #254)#1986
Copy link
Assignees
dezren39
Labels
effort/lLarge: multi-day or open-ended; expect staged check-inskind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobsource/humanFiled directly by a human

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Relocated from dezren39/darwin-nix#355 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).

Summary

Tool filters (tools, extraIncludeTools, excludeTools; #351, #352) decide by tool name: a tool is either callable with any arguments or not callable at all. Many tools are safe with some arguments and unsafe with others, and the choice today is to give up the tool or accept its worst case:

tool safe unsafe
github.create_repository private: true in a known organization private: false, or no organization (lands in a personal account)
github.push_files, create_or_update_file, delete_file a feature branch main
datadog.execute_datadog_workflow a few reviewed workflow ids any workflow
any tool taking owner/org the caller's own organizations anyone's

This adds argument rules: per tool, and per argument across tools, a JSON Schema constraint that a call's arguments must satisfy, or mcpx refuses the call before it reaches the server.

Depends on

  • fix(id): cut the interrupted sync session on committed state, not a record count (#188) #254, JSON Schema validation. Rules are schemas, so they need a real validator (2020-12 by default, draft-07 and 2019-09 as servers use them, local $ref only). Shipping this first would mean a second partial validator alongside internal/mcpspec's test subset. fix(id): cut the interrupted sync session on committed state, not a record count (#188) #254 lands the validator, and both upstream inputSchema validation and these rules use it.

Related: #114 (tool views: pin, rename, narrow a schema; this is its "narrow a schema" and part of "pin an argument"), #340 (ask/allow/deny write policy; see below), #257 (annotation trust: rules are keyed by name and arguments, never by server-supplied hints).

Proposal

A per-server argumentRules map in the mcpx block, also allowed in the top-level pool block. Keys are tool patterns, matched exactly as tools/excludeTools match: exact name, glob (delete_*), or /regexp/. Values are JSON Schema objects. A call is allowed only if its arguments validate against every rule whose key matches the tool.

"github": {
  "mcpx": {
    "argumentRules": {
      // Per function: the whole argument object.
      "create_repository": {
        "required": ["private", "organization"],
        "properties": {
          "private": { "const": true },
          "organization": { "pattern": "^(my-org|my-org-sandbox)$" }
        }
      },
      // Several functions, one rule.
      "/^(push_files|create_or_update_file|delete_file)$/": {
        "required": ["branch"],
        "properties": { "branch": { "not": { "enum": ["main", "master"] } } }
      },
      // Per argument, across every tool that has it: `properties` applies only
      // when the argument is present, so tools without an `owner` are untouched.
      "*": {
        "properties": { "owner": { "pattern": "^(my-org|my-user)$" } }
      }
    }
  }
},
"datadog": {
  "mcpx": {
    "argumentRules": {
      "execute_datadog_workflow": {
        "required": ["workflow_id"],
        "properties": { "workflow_id": { "enum": ["<id-1>", "<id-2>"] } }
      }
    }
  }
}

Per function and per argument are the same mechanism: a per-argument rule is a schema with properties under a key matching many tools. No second syntax is needed. A shorthand could come later if the properties wrapper proves noisy.

What a constraint can say

Anything JSON Schema says, including:

  • const, enum, not
  • pattern (regular expressions; see the dialect note under Limits)
  • minimum/maximum, maxLength, maxItems
  • required
  • if/then across arguments, e.g. "if organization is absent, refuse"
  • items for array arguments, e.g. every path in push_files.files[*].path under docs/

Semantics

  • Where it is checked: in resolveAndGuard, the step every tool call path shares (Call, CallReporting, CallAsk). It runs after the hidden-tool check and before elicit.confirmDestructive, and before the pool is touched, so a refused call starts nothing.
  • Refusal: 400, as a hidden tool is. The message names the argument path (/organization), what was sent, the constraint, and where the rule came from (config file, server, key). It's rendered like mcpx diagnose output, so an agent can correct itself.
  • Combining: every matching rule applies (allOf). Pool and server rules add up, and so do rules from layered config files: rules only tighten, and a nearer file cannot loosen a farther one's. That's the same reasoning as excludeTools.
  • Advertising: the effective schema is the upstream inputSchema allOf every matching rule. It's what mcpx types, the generated TypeScript client, search, and the MCP pass-through's tools/list show. An agent sees private: true in the types before it ever calls, and mcpx diagnose/the pre-run check refuse a script that cannot satisfy it without running it.
  • Validation of the rules themselves: a value that is not a valid schema, or a pattern that does not compile, is a configuration error naming the server and key, the same as a bad tool pattern today.
  • Dead rules: a key matching no tool, or a properties entry naming an argument no matched tool has, is a warning at load and on every catalog change. A server that renames organization to org must not silently disable the rule. catalog-history already detects the schema change and can say which rule it orphaned.
  • Server defaults are invisible: a schema constrains what is sent, not what the server fills in. create_repository defaults private to true today, but a rule that relies on that is one server release from wrong. Constraints that matter should list the argument in required. The docs should say so plainly.

Relationship to #340 (ask/allow/deny)

An argument rule is a deny with a condition. #340 needs the same condition for "ask before execute_datadog_workflow unless the id is one of these". Design the two together:

  • Shared: one rule shape, { tool pattern, when: <schema>, action: deny | ask | allow }. argumentRules is the deny-only form, and can be implemented first as exactly that.
  • Separate: whatever ends up in the config, the evaluator is one function so the two can never disagree.

Possible follow-up: pinning (#114)

"set": { "private": true } would inject a value when the caller omits it and refuse a different one. It's useful but changes what reaches the server, so it should be a separate step with its own tests, after deny-only rules are solid.

Limits

  • Pattern dialect. JSON Schema pattern is ECMA-262. If fix(id): cut the interrupted sync session on committed state, not a record count (#188) #254 picks a Go RE2-based validator, lookaround and backreferences are unsupported. A rule using them must be a load-time error, not a pattern that silently never matches.
  • Free-form arguments. A query/jql/sql string can be pattern-matched but not truly constrained. pattern: "env:production" does not stop OR env:*. The docs should say that a tool whose danger lives in a free-form argument belongs in excludeTools, not in a rule.
  • Equivalent arguments. Some servers accept the same thing two ways, such as owner vs organization, or an id vs a URL. A rule must cover each spelling, and the dead-rule warning cannot detect a missed synonym.
  • Arguments are not effects. A rule constrains the request mcpx forwards. It does not stop a server from doing something its arguments did not say.

Acceptance

  • Unit tests:
    • tool-pattern keys
    • allOf composition across pool, server and layered files
    • schema validity and pattern-dialect errors
    • dead-rule detection, including after a catalog change
  • Registry test over all three call paths: a violating call is refused before the pool is touched; a conforming one reaches it. That's the shape of TestAHiddenToolCannotBeCalled.
  • An e2e test through the real daemon and fake server: refused and allowed calls, the 400 body naming the argument path, and the tightened schema in mcpx types and the generated client.
  • A pass-through test: an MCP client sees the tightened inputSchema in tools/list and gets an error result, not a transport failure, on a refused call.
  • Falsification for each mechanism, recorded in the commit body: disable the check, the composition, and the advertising in turn, and show the test that fails.
  • Docs: a section beside "Hiding tools" in docs/configuration.md, with the server-default and free-form-argument cautions.

Open questions

  1. Name: argumentRules, argumentConstraints, or rules folded into a single policy block shared with pkgs/identity builds only with -tags sqlite|libsql and nothing in CI says so — plain go build fails on 3 undefined symbols #340.
  2. Per-argument shorthand: should "args": { "owner": {...} } exist as sugar for "properties", or is one syntax better?
  3. Refusal on the pass-through: an MCP client gets a tool result with isError: true and the explanation (agent-readable, recommended) or a JSON-RPC error.

Acceptance criteria

  • Blocked on fix(id): cut the interrupted sync session on committed state, not a record count (#188) #254: a shared JSON Schema validator (2020-12 default; draft-07/2019-09; local $ref only) exists and is used by both upstream inputSchema validation and argument rules
  • argumentRules is accepted in per-server mcpx blocks and the top-level pool block; keys match exactly as tools/excludeTools do (exact, glob, /regexp/)
  • A call is refused before reaching the server when its arguments fail any matching rule, with a refusal that names the rule; calls matching no rule are untouched
  • The worked examples from the proposal (create_repository private+org pin, branch-not-main, owner allowlist, workflow-id allowlist) are covered by tests, including the per-argument * form applying only when the argument is present

Activity

Next
  1. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    History carried over from dezren39/darwin-nix#355 (verbatim, oldest first):


    @dezren39 · 2026-10-27T11:10:02Z

    Intake review — fleet monitor (2026-10-27)

    Still live; explicitly sequenced. #254 (the shared JSON Schema validator this depends on) is still open, so this is correctly parked behind it — the proposal's own reasoning (no second partial validator) stands.

    Related: #254 (dependency), #114 (tool views — 'narrow a schema' / 'pin an argument'), #340 (ask/allow/deny write policy — rules are the static complement to its runtime confirmation), #257 (annotation trust — rules key on names/arguments, never server hints).

    Risks: rule semantics that differ subtly from tools matching would surprise operators; acceptance pins matching parity.

    Suggested approach: none until #254 lands; then implement against the proposal's config shape as written.

  2. developing-today commented on Oct 28, 2026

    @developing-today
    developing-todayBot
    on Oct 28, 2026 – with developing.today
    Contributor
    More actions

    CODE-911

  3. dezren39
    added
    status/needs-triageNot yet triaged; needs a first look
    source/humanFiled directly by a human
    priority/normalOrdinary priority (the default)
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    kind/enhancement
    queue/queuedHas a queued queue task
    on Oct 28, 2026
  4. github-actions
    assigned
    dezren39
    on Oct 29, 2026
  5. dezren39
    added a parent issue on Oct 29, 2026
    • Design: mcpx write policy — one gate for writes (ask/allow/deny, argument rules, unknown-outcome ledger) #2126
  6. dezren39
    added
    source/design-architectFiled by the repo design architect job
    status/blockedQueue or user escalation state
    on Oct 29, 2026
  7. dezren39 commented on Oct 29, 2026

    @dezren39
    dezren39
    on Oct 29, 2026
    MemberAuthor
    More actions

    Design architect (pass 12, 2026-10-29): this issue is Phase 2 of design #2126 (mcpx write policy — one gate for writes), adopted as a sub-issue of #2126; design doc: files/designs/code-mcpx-write-policy.md in the keep-the-four-repos-healthy goal workspace. Labelled status/blocked: gated on Phase 1 (#1979), which builds the shared evaluator, the write classification, and the args plumbing into resolveAndGuard that this phase's rules evaluate inside.

    Design decisions that bind it (recorded on #2126 and in the doc): open question 1 resolved — the config name is argumentRules (server mcpx block + top-level pool block), NOT a folded policy block; the evaluator is what is shared with #1979. Open question 3 resolved — refusals render natively per surface, following the hidden-tool precedent (daemon 400 naming argument path/value/constraint/rule origin; MCP pass-through isError: true tool result). Open question 2: no per-argument shorthand in v1. Rules evaluate before the mode step in the guard chain (a rule refusal must win over an allow mode) and only tighten across layered files. The #254 dependency is satisfied in code by #1482/#1483 (internal/schemaval, internal/mcpclient/schemacheck.go); before building, confirm #1951's in-review reconciliation does not reopen the validator question. Schema advertising (allOf in mcpx types/tools/list) is deferred past this phase as a documented open question on #2126 — it is not part of this phase's acceptance.

    Triage note: this issue already has a queued triage packet (relocation). Triage should NOT re-file or split this scope — the implementation issue is this one; verdict should point at #2126, record the Phase 1 gate, and leave status/blocked in place until #1979 lands.

    {"kind":"design-phase","by":"repo-design-architect-code","pass":12,"date":"2026-10-29","design_issue":2126,"phase":2,"gated_on":1979}
    
  8. dezren39
    added
    work/assignedQueue worker lifecycle state
    on Oct 29, 2026
  9. 149 remaining items

  10. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Oct 31, 2026
  11. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code), Lane B shift
    • Session / ID: queue task 3282
    • Found via: queue claim (resume from park)
    • Task: PR 2855 CI still pending — run 41172360573: lint + plugin-tests jobs remain QUEUED (runner backlog) after a 5-minute poll; stress PR-changed-tests PASS, docs PASS. Codex gate re-verified fresh this shift: current-head review present, 18/18 threads resolved, 0 unresolved.
    • Expectation: parked 20m; resume = lint+plugin green → merge PR 2855 → close this issue → complete task fixed_merged.
    • Links: PR mcpx: argument rules — per-tool/per-argument JSON Schema call constraints (#1986) #2855 @32953e95b
  12. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 31, 2026
  13. dezren39
    added a commit that references this issue on Oct 31, 2026

    mcpx: argument rules — per-tool/per-argument JSON Schema call constra…

    cffd524
  14. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), Lane B shift
    • Session / ID: queue task 3282
    • Found via: queue claim (resume from park)
    • Task: PR mcpx: argument rules — per-tool/per-argument JSON Schema call constraints (#1986) #2855 MERGED — squash merge commit cffd524fd5e5917a321eb5a25bc35e1bb9e2977c. Final gate evidence: mcpx CI run 41172360573 CONCLUSION SUCCESS (lint, plugin tests, PR-changed stress tests, final budget all PASS; docs PASS); Codex gate clean (current-head review, 18/18 threads resolved, 0 unresolved). Argument rules (Phase 2 of Design: mcpx write policy — one gate for writes (ask/allow/deny, argument rules, unknown-outcome ledger) #2126) are landed: per-server + pool argumentRules compiled by internal/schemaval, allOf tightening in resolveAndGuard before the write-mode step, per-surface refusals, effective-schema advertising.
    • Expectation: done — closing this issue; task 3282 completed as fixed_merged.
    • Links: PR mcpx: argument rules — per-tool/per-argument JSON Schema call constraints (#1986) #2855
  15. dezren39
    closed this as completedon Oct 31, 2026
  16. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

effort/lLarge: multi-day or open-ended; expect staged check-inskind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobsource/humanFiled directly by a human

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.