Skip to content

Only show the Apps, Prompts, and Resources tabs when the server exposes the relevant items #1450

@cliffhall

Description

@cliffhall

Background

The Apps, Prompts, and Resources tabs are currently always present in the navigation once connected, even when the connected server exposes nothing for them. In that case the screen is empty/unusable, which is confusing — a tab should only appear when there's something to show.

The Apps pieces already exist in clients/web/src/components/views/InspectorView/InspectorView.tsx:

  • appTools is computed by filtering the tool list with isAppTool (from @inspector/core/mcp/apps.js, which detects _meta.ui.resourceUri):
    const appTools = useMemo<Tool[]>(() => tools.filter((t) => { try { return isAppTool(t); } catch { return false; } }), [tools]);
  • ALL_TABS unconditionally includes "Apps", "Prompts", and "Resources", and availableTabs only removes Network for stdio.

Scope

Content-gate three tabs in availableTabs so an empty screen is never reachable. Each gate keys on list contents (not on advertised capability), and because availableTabs is a useMemo over these lists, each tab appears/disappears reactively as the lists change (a tools/list_changed refresh, switching servers):

  • Apps — gate on appTools.length > 0 (compute appTools before availableTabs). When app tools exist but the sandbox is unavailable, keep showing the tab so the "MCP Apps are unavailable" message stays reachable; only hide it when there are zero app tools.
  • Prompts — gate on prompts.length > 0.
  • Resources — gate on resources.length > 0 || resourceTemplates.length > 0 (a server may expose only templates).

The existing activeTab fallback already redirects to Servers when the selected tab isn't in availableTabs, so a user sitting on a tab when it disappears lands somewhere valid — verify this still holds.

Acceptance criteria

  • When the connected server exposes no MCP App tools, no prompts, or no resources/templates, the corresponding Apps / Prompts / Resources tab is not shown and its screen is not reachable.
  • When the server exposes one or more of the relevant items, the corresponding tab appears as today.
  • Each tab updates live as its list changes — in particular, a list that goes from empty to non-empty after connecting/refresh reveals the associated tab.
  • No regression to the existing activeTab-fallback behavior.
  • Unit tests cover both states for each tab (empty → no tab; non-empty → tab present) plus the empty→non-empty live transition; npm run validate, test:integration, and test:storybook pass.

References

  • clients/web/src/components/views/InspectorView/InspectorView.tsx (ALL_TABS, availableTabs, appTools)
  • core/mcp/apps.ts (isAppTool)
  • clients/web/src/components/screens/AppsScreen/AppsScreen.tsx

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions