Skip to content

Synchronize Gateway Activation State Across Tools, Prompts, and Resources#2211

Merged
crivetimihai merged 1 commit intomainfrom
issue_server_view_status
Jan 20, 2026
Merged

Synchronize Gateway Activation State Across Tools, Prompts, and Resources#2211
crivetimihai merged 1 commit intomainfrom
issue_server_view_status

Conversation

@rakdutta
Copy link
Copy Markdown
Collaborator

@rakdutta rakdutta commented Jan 20, 2026

closes issue #2212
This pull request enhances the gateway activation and deactivation process by ensuring that prompt and resource states are updated in sync with the gateway state, in addition to tools. It also updates the frontend to use the correct property for gateway status display and improves unit tests to cover these new behaviors.

Gateway state management improvements:

  • When a gateway is activated or deactivated, the system now updates the states of all associated prompts and resources using the new PromptService and ResourceService, and invalidates their respective caches after batch updates.
  • The GatewayService class is updated to instantiate and use PromptService and ResourceService for these state changes. [1] [2]

Frontend status display update:

  • The admin UI now uses the enabled property instead of isActive to determine and display the gateway's active/inactive status.

Unit test coverage enhancements:

  • Unit tests for gateway state changes now verify that state changes are applied to tools, prompts, and resources, with appropriate mocks and assertions added for the new services. [1] [2] [3] [4] [5] [6]

@rakdutta rakdutta marked this pull request as ready for review January 20, 2026 11:40
@kevalmahajan kevalmahajan force-pushed the issue_server_view_status branch from 0786db8 to 1b61459 Compare January 20, 2026 13:48
Copy link
Copy Markdown
Member

@kevalmahajan kevalmahajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and rebased

  1. The bug with Active virtual servers shown as inactive in the view panel is resolved now.
  2. The Prompts and Resources toggles active or inactive when the MCP server is toggled, similar to how tool toggles behave.

… resources

When a gateway is activated or deactivated, the system now updates the
states of all associated prompts and resources in addition to tools.
This ensures consistent behavior across all gateway-related entities.

Changes:
- Add PromptService and ResourceService to GatewayService for state sync
- Update prompts and resources state when gateway state changes
- Add skip_cache_invalidation parameter to set_prompt_state and
  set_resource_state for batch operation optimization (consistent with
  tool_service implementation)
- Skip prompt/resource DB queries when only_update_reachable=True to
  avoid unnecessary DB work during health checks
- Fix admin UI to use 'enabled' property instead of 'isActive' for
  gateway status display
- Add unit tests for prompt and resource state synchronization
- Add unit test verifying prompts/resources are skipped for reachability-only updates

Co-authored-by: rakdutta <rakhibiswas@yahoo.com>
Closes #2212

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai merged commit 96db398 into main Jan 20, 2026
51 checks passed
@crivetimihai crivetimihai deleted the issue_server_view_status branch January 20, 2026 23:52
@crivetimihai crivetimihai self-assigned this Jan 23, 2026
@crivetimihai crivetimihai added the broken-pr PR is broken, will need to be fixed or reverted label Jan 23, 2026
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
… resources (IBM#2211)

When a gateway is activated or deactivated, the system now updates the
states of all associated prompts and resources in addition to tools.
This ensures consistent behavior across all gateway-related entities.

Changes:
- Add PromptService and ResourceService to GatewayService for state sync
- Update prompts and resources state when gateway state changes
- Add skip_cache_invalidation parameter to set_prompt_state and
  set_resource_state for batch operation optimization (consistent with
  tool_service implementation)
- Skip prompt/resource DB queries when only_update_reachable=True to
  avoid unnecessary DB work during health checks
- Fix admin UI to use 'enabled' property instead of 'isActive' for
  gateway status display
- Add unit tests for prompt and resource state synchronization
- Add unit test verifying prompts/resources are skipped for reachability-only updates


Closes IBM#2212

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

broken-pr PR is broken, will need to be fixed or reverted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants