Skip to content

feat(t0): minder_api step for tools that declare minder_scopes - #59

Merged
Resinder merged 2 commits into
mainfrom
feat/t0-minder-api-step
Nov 7, 2026
Merged

Resinder merged 2 commits into
mainfrom
feat/t0-minder-api-step

Conversation

@Resinder

@Resinder Resinder commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A declarative (T0) tool can now call Minder's own API with a minder_api step instead of an HTTP request.

tools:
  passages:
    description: Search the knowledge base.
    minder_scopes: [kb.search]          # new on a declarative tool
    parameters: {type: object, properties: {kb: {type: string}, q: {type: string}}}
    steps:
      - name: hits
        minder_api:
          route: "/v1/knowledge-bases/{params.kb}/search"   # must start with /v1/
          method: POST                                      # GET (default) or POST
          query: {limit: 5}
          body: {query: "{params.q}"}                       # POST only
        select: results
  • Execution: the engine calls the invocation's ctx.minder handle (ctx.minder.call(route, method=, query=, json=), capability minder.api).

    • Invocation gains minder. When it is unbound, for example in minder-plugin try, the step raises CapabilityDenied.
    • Errors from the capability pass through unchanged.
  • Results: the parsed answer is the step's result, as with an HTTP step. select, when, foreach, steps.<name> placeholders and JMESPath output mappings all work the same way.

  • Egress: this step is not external egress. It uses no egress rule, DNS lookup, rate limit or concurrency slot. It does count toward the per-invocation request cap.

  • Placeholders: route placeholders are path-encoded like request.path (/, . and .. are escaped). Query and body use the same templates as request.

  • Refused at load (ManifestError):

    • a minder_api step in a tool without minder_scopes, in an action or in the schedule;
    • minder_scopes on an action, an unknown scope (from context.MINDER_SCOPES), or a repeated scope;
    • a route that doesn't start with /v1/, or that has ?/# or an empty, . or .. segment;
    • a method other than GET/POST, or a body on GET;
    • a step with both or neither of request and minder_api.
  • Compiled model:

    • Step.request is now Optional, and the new Step.minder holds a MinderCall.
    • Operation.minder_scopes lets the host serve the scopes with the AI tool, so the platform grants minder.api for them.
  • Schema (declarative-manifest.schema.json):

    • new minderApi definition;
    • step.minder_api (oneOf with request);
    • operation.minder_scopes (an enum of the scopes, uniqueItems);
    • actions and schedule steps refuse minder_api.

    The engine model and the schema stay field-for-field equal.

  • README (the T0 section), CHANGELOG "Unreleased", and the every_field.yml fixture (a passages tool).

Compatibility

  • Additive for manifests: every existing manifest loads unchanged.
  • Step.request is now Optional[Request]. A host that reads step.request directly should check step.minder first.

Validation

  • black --check src tests examples: clean.
  • flake8 --max-line-length=100 --extend-ignore=E203,W503 src tests examples: clean.
  • mypy src (strict): no issues.
  • pytest tests: 1219 passed.

New tests:

  • Happy path with FakePlatformContext: a POST with query and body, the path-encoded route, the result chained into an HTTP step and the output mapping, and no DNS or egress for the Minder call.
  • Denied path: the capability is not granted, and, separately, no handle is bound.
  • Refused at load:
    • a tool without minder_scopes, an action, the schedule;
    • an unknown or repeated scope;
    • route and method rules, a body on GET, both or neither.
  • Schema:
    • unknown and required fields;
    • out-of-range route, method, query and scopes;
    • both request and minder_api;
    • minder_api in an action or the schedule, minder_scopes on an action;
    • body: null.

Review follow-up (a2f87f3)

  • The engine re-checks the rendered route for empty, . and .. segments and raises MappingError before any call. This replaces a check that could never fire. New test: an empty placeholder value is refused before the call.
  • In the schema, minderApi refuses a non-null body when the method is GET (including the GET default), as the engine does.
  • README and CHANGELOG: a minder_api result can feed a later request step, so the data can reach the plugin's egress hosts. A tool whose plugin declares egress counts as egressing for local-only content.

Merge order

Merge this first. The host bumps its SDK pin and serves the tool's minder_scopes afterwards. The published docs copy of the declarative schema must then be updated to stay byte-identical.

🤖 Generated with Claude Code

A declarative step may now be `minder_api: {route, method, query, body}`
instead of `request`. The engine runs it through the invocation's
`ctx.minder` handle (capability `minder.api`), not the plugin's egress. Its
parsed answer is the step's result, as with an HTTP step, so select, when,
foreach, steps.<name> and the output mapping work the same way. It counts
toward the per-invocation request cap.

The engine refuses these at load:
- a minder_api step in an action, in the schedule, or in a tool without
  minder_scopes (minder_scopes is new on a declarative tool);
- an unknown or repeated scope;
- a route that does not start with /v1/, or that has a query, a fragment or
  an empty, '.' or '..' segment;
- a method other than GET/POST, or a body on GET;
- a step with both or neither of request and minder_api.

Invocation gains `minder`; without it the step raises CapabilityDenied.
The declarative schema gains `minderApi`, `step.minder_api` (oneOf with
`request`) and `operation.minder_scopes`, and it refuses minder_api in
actions and the schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Resinder

Resinder commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Driven by session zeynep-portainer from 2026-11-07T05:02:29Z: it is the one session acting on this PR (pushes, reruns, merge). Protocol: minderhq/minder#2342.

…in the schema

- The engine now runs the load-time segment check again on the rendered
  route. An empty placeholder value would otherwise leave an empty segment.
  It raises MappingError before any call is made. This replaces a check that
  could never fire.
- In the schema, minderApi refuses a non-null body when the method is GET
  (including the GET default), as the engine does.
- README and CHANGELOG: a minder_api result can feed a later request step,
  so the data can reach the plugin's egress hosts. A tool whose plugin
  declares egress counts as egressing for local-only content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resinder added a commit to minderhq/docs that referenced this pull request Nov 7, 2026
Keeps the copy byte-identical with minderhq/plugin-sdk#59 at a2f87f31.

Agent-Session: zeynep-portainer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Resinder
Resinder merged commit 50a5213 into main Nov 7, 2026
4 checks passed
@Resinder
Resinder deleted the feat/t0-minder-api-step branch November 7, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant