@W-21254846: Add mechanism for conditional registration - #871
Merged
Conversation
stephendeoca
commented
Sep 1, 2026
stephendeoca
commented
Sep 1, 2026
stephendeoca
commented
Sep 1, 2026
10 tasks
13 tasks
…ion instructions (#881) * implement Pulse registration conditions and unmet-condition instructions Fills in the three pieces left open by the conditional-registration mechanism: the capability checks, the tool declarations, and the client-facing explanation. Capability checks (src/tools/web/registrationConditions.ts): - RequiresPulse has no dedicated availability endpoint, so checkPulseEnabled probes the cheapest Pulse read (a one-item page of metric definitions) and classifies the outcome. PulseDisabledError (site setting off) and PulseNotAvailableError (Tableau Server) are definitive answers and are not retried; anything indeterminate is retried and then fails closed. A site with no definitions still counts as enabled. - RequiresPulsePremium reads GET /api/-/pulse/entitlements and requires ENTITLEMENT_TYPE_PULSE_PREMIUM_INSIGHTS to be enabled -- the entitlement whose absence produces PulseInsightsDisabledError ("requires Tableau+"). It short-circuits on the memoized base Pulse probe first, so a tool declaring both conditions costs one probe per capability. The entitlements endpoint is new to the SDK: added the Zodios endpoint, the response schema (entitlement_type kept as a bare string so a new service-side enum member cannot fail validation and hide entitled tools), the getPulseEntitlements method, and the tableau:entitlements:read scope. Tool declarations: all eight Pulse-backed tools declare RequiresPulse, including generate-insight-cards, which routes through the Pulse insight bundle. The three AI-insight tools additionally declare RequiresPulsePremium. Initialization message (src/server.web.ts): unmet conditions now append a per-condition explanation to the initialize instructions, so a Pulse-less site is told Pulse is off and how to enable it instead of silently receiving a shorter tool list. Typed as a total Record so adding a condition without user-facing copy fails to compile. Note for operators: the premium probe requests tableau:entitlements:read, and a Connected App rejects a JWT mint asking for an un-granted scope, so a deployment turning on enforce-registration-conditions must grant that scope or the premium tools fail closed. * address review: genericize Pulse omit copy Stephen's notes on #881: - RequiresPulse: don't assume site-admin-disabled; Pulse can also be unavailable for user-level preferences or Tableau Server. Soften to "not available" and keep the Cloud setup link as optional guidance. - MissingConditionCheck: reconnect cannot help (missing code path). Drop the disconnect/reconnect advice and say the check is not implemented.
stephendeoca
added this pull request to stack #899
September 9, 2026 21:51
stephendeoca
removed this pull request from stack #899
September 9, 2026 23:53
stephendeoca
marked this pull request as ready for review
September 10, 2026 00:07
stephendeoca
commented
Sep 10, 2026
yyk16293
reviewed
Sep 10, 2026
yyk16293
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.
Pull Request Template
Description
Introduces a new tool property called
registrationConditionswhich can be used to indicate if a certain criteria has been met before registering the tool. When a tool specifies a registration condition, a method for checking the condition must be implemented. The registration context object is also populated so that conditions do not need to be rechecked with every tool. This logic is gated by theenforce-registration-conditionsfeature flag.Introduces 2 conditions,
RequiresPulseandRequiresPulsePremium.Motivation and Context
As we increase our surface area of tools, we want to make sure only the relevant tools are registered for a user. For example, if pulse is not available for a site then the pulse tools should not be registered for a user.
Type of Change
Version Bump
Version is bumped automatically after merge. Select the bump this PR needs (defaults to Patch if none selected):
How Has This Been Tested?
Related Issues
N/A
Checklist
environment variable or changing its default value.
Contributor Agreement
By submitting this pull request, I confirm that:
its Contribution Checklist.