Description
When using pagination controls for tools, prompts, and resources in the admin UI, the URL query parameters get mixed up between different tables. This creates URLs that contain pagination parameters from multiple tables simultaneously, even when only viewing one table.
Current Behavior
When navigating between different tables (tools, prompts, resources) and their pagination controls:
-
Navigate to Tools page 3 with size 10
- URL:
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false#tools
-
Switch to Prompts tab and navigate to page 2
- URL:
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false#prompts
-
Switch to Resources tab and navigate to page 2
- URL:
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false&resources_page=2&resources_size=10&resources_inactive=false#resources
-
Switch back to Tools tab
- URL: Still contains
prompts_page, prompts_size, resources_page, etc.
Expected Behavior
Each tab should only have its own table's query parameters in the URL:
- When on Tools tab:
?tools_page=3&tools_size=10&tools_inactive=false#tools
- When on Prompts tab:
?prompts_page=2&prompts_size=10&prompts_inactive=false#prompts
- When on Resources tab:
?resources_page=2&resources_size=10&resources_inactive=false#resources
Root Cause
Two issues were identified:
-
Pagination controls accumulating params: The updateBrowserUrl() function in pagination_controls.html and updateInactiveUrlState() in admin.html were using a "Build Fresh" approach that preserved existing params, causing params from other tables to accumulate.
-
Tab switching not cleaning up params: The showTab() function in admin.js did not remove query parameters from other tables when switching between tabs.
Impact
- URLs become cluttered with irrelevant pagination state
- Bookmarked URLs may contain confusing mixed parameters
- URL sharing becomes less user-friendly
- Parameter pollution makes debugging harder
Files Affected
mcpgateway/templates/pagination_controls.html
mcpgateway/templates/admin.html
mcpgateway/static/admin.js
Description
When using pagination controls for tools, prompts, and resources in the admin UI, the URL query parameters get mixed up between different tables. This creates URLs that contain pagination parameters from multiple tables simultaneously, even when only viewing one table.
Current Behavior
When navigating between different tables (tools, prompts, resources) and their pagination controls:
Navigate to Tools page 3 with size 10
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false#toolsSwitch to Prompts tab and navigate to page 2
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false#promptsSwitch to Resources tab and navigate to page 2
http://localhost:4444/admin/?tools_page=3&tools_size=10&tools_inactive=false&prompts_page=2&prompts_size=10&prompts_inactive=false&resources_page=2&resources_size=10&resources_inactive=false#resourcesSwitch back to Tools tab
prompts_page,prompts_size,resources_page, etc.Expected Behavior
Each tab should only have its own table's query parameters in the URL:
?tools_page=3&tools_size=10&tools_inactive=false#tools?prompts_page=2&prompts_size=10&prompts_inactive=false#prompts?resources_page=2&resources_size=10&resources_inactive=false#resourcesRoot Cause
Two issues were identified:
Pagination controls accumulating params: The
updateBrowserUrl()function inpagination_controls.htmlandupdateInactiveUrlState()inadmin.htmlwere using a "Build Fresh" approach that preserved existing params, causing params from other tables to accumulate.Tab switching not cleaning up params: The
showTab()function inadmin.jsdid not remove query parameters from other tables when switching between tabs.Impact
Files Affected
mcpgateway/templates/pagination_controls.htmlmcpgateway/templates/admin.htmlmcpgateway/static/admin.js