Skip to content

Support per-call server selection for OpenAPI tools#952

Merged
RhysSullivan merged 3 commits into
UsefulSoftwareCo:mainfrom
SferaDev:openapi-per-call-server-selection
Jun 12, 2026
Merged

Support per-call server selection for OpenAPI tools#952
RhysSullivan merged 3 commits into
UsefulSoftwareCo:mainfrom
SferaDev:openapi-per-call-server-selection

Conversation

@SferaDev

@SferaDev SferaDev commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Resolve OpenAPI servers per tool call instead of baking a single base URL at add time. Operations can declare multiple servers (document, path, or operation level) and templated URLs with {variables}; each is now selectable when invoking the tool.

Changes

  • Per-call server input. Each generated tool exposes an optional server input ({ url?, variables? }), shown only when there is something to choose: url becomes an enum when more than one server applies, and variables are drawn from the applicable servers. This mirrors the existing synthetic contentType input.
  • Invoke-time host resolution. A connection base URL override wins when set; otherwise the call's chosen server (server.url, or the first applicable) is resolved with its {variables} (call values, else spec defaults); otherwise no host is prepended.
  • Base URL is now an optional override. Off by default, required only when the spec declares no servers. The source form shows a combobox when there is more than one top-level server and a plain input otherwise, with the first server's resolved URL as the placeholder.
  • Removed connection-level serverVariables in favor of per-call variables.

Compatibility

Bindings persisted before this change keep working: a missing servers field is treated as empty and falls back to the connection base URL.

End-to-end coverage

Two scenarios pin this behavior end to end:

  • APIe2e/scenarios/openapi-server-selection.test.ts: a multi-server spec, added through the typed API with no base URL, produces a tool whose input schema exposes the per-call server selector — a url enum over the declared servers plus the templated server's {variables}. Runs on cloud and selfhost.
  • UIe2e/scenarios/openapi-server-selection-ui.test.ts: pasting a multi-server spec turns the add form's Base URL field into a picker over those servers and relabels it an optional override, with a hint that the host is otherwise chosen per tool call.

OpenAPI · the add form offers a server picker and an optional base URL for a multi-server spec (cloud)

@SferaDev SferaDev marked this pull request as draft June 10, 2026 18:58
@SferaDev SferaDev force-pushed the openapi-per-call-server-selection branch from 36f9bd4 to 9145db0 Compare June 10, 2026 19:03
@SferaDev SferaDev marked this pull request as ready for review June 10, 2026 19:05
@RhysSullivan RhysSullivan force-pushed the openapi-per-call-server-selection branch from 9145db0 to be10057 Compare June 11, 2026 19:03
SferaDev and others added 2 commits June 11, 2026 22:21
Resolve OpenAPI servers per tool call instead of baking a single base
URL at add time. Operations can declare multiple servers (document,
path, or operation level) and templated URLs with {variables}; each is
now selectable when invoking the tool.

- Each tool exposes an optional `server` input ({ url?, variables? }),
  shown only when there is something to choose: `url` becomes an enum
  when more than one server applies, and `variables` are drawn from the
  applicable servers.
- Host resolution: a connection base URL override wins when set;
  otherwise the call's chosen server (server.url or the first
  applicable) is resolved with its {variables} (call values, else spec
  defaults); otherwise no host is prepended.
- The connection base URL becomes an optional override (off by
  default), required only when the spec declares no servers. The form
  shows a combobox for multiple top-level servers and a plain input
  otherwise, with the first server's resolved URL as the placeholder.
- Drop connection-level serverVariables in favor of per-call variables.
- Bindings persisted before this change keep working: a missing
  `servers` field is treated as empty and falls back to the connection
  base URL.
A multi-server spec, added through the typed product API, must turn into a
tool that advertises the per-call `server` selector: a `url` enum over the
declared servers plus the `{variables}` drawn from the templated one. The
scenario also pins the base URL as an optional override — addSpec succeeds
with no baseUrl, the host being resolved per call from the spec's servers.

Cross-target (cloud + selfhost), driven entirely through the typed client.
@RhysSullivan RhysSullivan force-pushed the openapi-per-call-server-selection branch from be10057 to 3eb8d67 Compare June 12, 2026 05:24
Records the UI side of per-call server selection: pasting a spec that
declares more than one server turns the Add OpenAPI source form's Base URL
field into a picker over those servers and relabels it an optional override,
with a hint that the host is otherwise chosen per tool call. The session
video and step screenshots are the artifact; the scenario skips on targets
without a browser surface.
@RhysSullivan RhysSullivan merged commit 757cc96 into UsefulSoftwareCo:main Jun 12, 2026
@RhysSullivan

Copy link
Copy Markdown
Collaborator

thanks!

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.

2 participants