Skip to content

Rename Toggle Endpoint to State for Clear and Explicit Status Updates(issue1497)#2092

Merged
crivetimihai merged 1 commit intomainfrom
issue_toggle_1497
Jan 19, 2026
Merged

Rename Toggle Endpoint to State for Clear and Explicit Status Updates(issue1497)#2092
crivetimihai merged 1 commit intomainfrom
issue_toggle_1497

Conversation

@rakdutta
Copy link
Copy Markdown
Collaborator

@rakdutta rakdutta commented Jan 14, 2026

closes issue #1497
This pull request standardizes API endpoints and related documentation by replacing the verb "toggle" with "state" for activating or deactivating resources across the codebase, documentation, and admin UI. This change improves clarity and consistency for users and developers interacting with the system.

API and Endpoint Changes

  • All REST endpoints for toggling resource states (servers, gateways, tools, agents, prompts, resources, gRPC services) have been renamed from /toggle to /state, clarifying that the endpoint sets the state rather than simply toggling it. [1] [2] [3]

Documentation Updates

  • All relevant documentation files (README.md, docs/docs/index.md, docs/docs/manage/api-usage.md, docs/docs/using/grpc-services.md) have been updated to use the new /state endpoint in example API calls, ensuring instructions match the codebase. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

Architecture and ADR Updates

  • Architecture Decision Records have been updated to reflect the new terminology, replacing "toggle" with "state" for cache invalidation logic and gateway/tool operations.

Code and Test Refactoring

  • Admin UI route handlers and associated docstrings, logging, and test code have been refactored to use the new "state" terminology and method names (e.g., set_server_state instead of toggle_server_status), improving code clarity and alignment with endpoint changes. [1] [2]

These changes collectively enhance the clarity and maintainability of both the API and its documentation, making it easier for users and developers to understand and interact with resource state management.

@rakdutta rakdutta marked this pull request as ready for review January 19, 2026 07:27
@rakdutta rakdutta changed the title Issue toggle 1497 Rename Toggle Endpoint to State for Clear and Explicit Status Updates(issue1497) Jan 19, 2026
@crivetimihai crivetimihai self-assigned this Jan 19, 2026
@crivetimihai crivetimihai force-pushed the issue_toggle_1497 branch 2 times, most recently from 9105a8f to eeee1f9 Compare January 19, 2026 14:15
Closes #1497

Changes:
- Rename all /toggle endpoints to /state
- Add deprecated /toggle aliases that redirect to /state
- Update LLM provider/model state methods to accept explicit activate parameter
- Add GET /resources/{resource_id}/info endpoint
- Update gRPC /state endpoint to accept explicit activate parameter
- Fix admin UI gRPC form paths to include /admin prefix
- Update admin UI to pass explicit state for gRPC services
- Update audit trail actions and structured logging event types
- Update error messages and log messages
- Update test function names from toggle to state for consistency
- Update locust load test function names for consistency
- Update docs: ADR-011 and code2flow.svg references

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai
Copy link
Copy Markdown
Member

Changes Summary

This PR has been rebased, reviewed, and updated with the following changes:

Core API Changes

  • Renamed all /toggle endpoints to /state across servers, A2A agents, tools, resources, prompts, and gateways
  • Added deprecated /toggle aliases that redirect to /state (will be removed in a future release)
  • Updated LLM provider/model state methods to accept explicit activate parameter
  • Added GET /resources/{resource_id}/info endpoint for getting resource metadata including enabled status
  • Updated gRPC /state endpoint to accept explicit activate parameter

Admin UI

  • Fixed gRPC form paths to include /admin prefix
  • Updated gRPC state form to pass explicit activate parameter

Audit & Logging

  • Updated audit trail actions from toggle_*_status to set_*_state
  • Updated structured logging event types from *_toggled to *_state_changed
  • Updated error messages from "Failed to toggle" to "Failed to set state"

Tests

  • Renamed test functions from test_toggle_*_status to test_set_*_state for consistency
  • Updated locust load test function names
  • All 5163 tests passing

Documentation

  • Updated ADR-011 reference from toggle_gateway_status to set_gateway_state
  • Updated code2flow.svg diagram function names

Code Quality

  • Fixed flake8 and pylint issues
  • Moved warnings import to top-level to avoid import-outside-toplevel
  • Renamed warnings variable to security_warnings to avoid shadowing the module

@crivetimihai crivetimihai merged commit 060ba4c into main Jan 19, 2026
50 checks passed
@crivetimihai crivetimihai deleted the issue_toggle_1497 branch January 19, 2026 15:45
gabe-l-hart added a commit to contextforge-org/contextforge-cli that referenced this pull request Jan 27, 2026
This was refactored in
IBM/mcp-context-forge#2092

Branch: RemoveToggle

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
kcostell06 pushed a commit to kcostell06/mcp-context-forge that referenced this pull request Feb 24, 2026
IBM#2092)

Closes IBM#1497

Changes:
- Rename all /toggle endpoints to /state
- Add deprecated /toggle aliases that redirect to /state
- Update LLM provider/model state methods to accept explicit activate parameter
- Add GET /resources/{resource_id}/info endpoint
- Update gRPC /state endpoint to accept explicit activate parameter
- Fix admin UI gRPC form paths to include /admin prefix
- Update admin UI to pass explicit state for gRPC services
- Update audit trail actions and structured logging event types
- Update error messages and log messages
- Update test function names from toggle to state for consistency
- Update locust load test function names for consistency
- Update docs: ADR-011 and code2flow.svg references

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants