Skip to content

Commit 4778311

Browse files
Added MCP to preview feature and added preview feature enablement in settings
1 parent 41bdcab commit 4778311

7 files changed

Lines changed: 31 additions & 30 deletions

File tree

src/renderer/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</button>
4141
</nav>
4242
<nav class="activity-bar-footer">
43-
<button class="activity-item" id="agent-invocation-logs-btn" title="MCP Server (Preview)">
43+
<button class="activity-item" id="mcp-btn" title="MCP Server (Preview)">
4444
<img id="logs-icon" src="icons/dark/mcp.svg" alt="MCP Icon" class="activity-icon" />
4545
</button>
4646
<button class="activity-item" id="settings-activity-btn" title="Settings">

src/renderer/modules/agentInvocationLogsManagement.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { openLocalPageAsTab, registerCloseGuard } from "./toolManagement";
77
export function renderAgentInvocationLogsContent(panel: HTMLElement): void {
88
panel.className = "settings-tab-container";
99
panel.innerHTML = `
10-
<div class="settings-tab-content" id="agent-invocation-logs-tab">
10+
<div class="settings-tab-content" id="mcp-tab">
1111
<div class="settings-vscode-section">
1212
<h2 class="settings-vscode-section-title">
1313
MCP Server
@@ -79,8 +79,8 @@ export function renderAgentInvocationLogsContent(panel: HTMLElement): void {
7979
</div>
8080
</div>
8181
82-
<div id="agent-invocation-logs-container" class="invocation-logs-container">
83-
<div class="empty-state" id="agent-invocation-logs-empty" style="display: none;">
82+
<div id="mcp-container" class="invocation-logs-container">
83+
<div class="empty-state" id="mcp-empty" style="display: none;">
8484
<p>No agent invocations recorded yet.</p>
8585
<p class="empty-state-hint">Invoke tools through the MCP server to see activity here.</p>
8686
</div>
@@ -129,8 +129,8 @@ function getOutcomeBadgeStyle(outcome: string): string {
129129
async function loadAndRenderLogs(): Promise<void> {
130130
try {
131131
const [serverDetails, logs] = await Promise.all([window.toolboxAPI.mcpServer.getDetails(), window.toolboxAPI.agentInvocation.getLogs()]);
132-
const container = document.getElementById("agent-invocation-logs-container");
133-
const emptyState = document.getElementById("agent-invocation-logs-empty");
132+
const container = document.getElementById("mcp-container");
133+
const emptyState = document.getElementById("mcp-empty");
134134
const table = document.getElementById("invocation-logs-table");
135135
const tbody = document.getElementById("invocation-logs-tbody");
136136
const statusLabel = document.getElementById("mcp-server-status");
@@ -187,7 +187,7 @@ async function loadAndRenderLogs(): Promise<void> {
187187
.join("");
188188
} catch (error) {
189189
logError("Failed to load agent invocation logs", error);
190-
const container = document.getElementById("agent-invocation-logs-container");
190+
const container = document.getElementById("mcp-container");
191191
if (container) {
192192
container.innerHTML = `<div class="empty-state"><p>Error loading logs</p><p class="empty-state-hint">${escapeHtml(error instanceof Error ? error.message : String(error))}</p></div>`;
193193
}
@@ -244,8 +244,8 @@ function escapeHtml(text: string): string {
244244
* Open agent invocation logs as a tab
245245
*/
246246
export async function openAgentInvocationLogsTab(): Promise<void> {
247-
registerCloseGuard("agent-invocation-logs", async () => {
247+
registerCloseGuard("mcp", async () => {
248248
return true;
249249
});
250-
await openLocalPageAsTab("agent-invocation-logs", "MCP Server", renderAgentInvocationLogsContent, "");
250+
await openLocalPageAsTab("mcp", "MCP Server", renderAgentInvocationLogsContent, "");
251251
}

src/renderer/modules/initialization.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ import { clearMarketplaceDropdownFilters, handleProtocolInstallToolRequest, load
3131
import { openAgentInvocationLogsTab } from "./mcpManagement";
3232
import { closeModal, openModal } from "./modalManagement";
3333
import { initNotificationHistoryPanel, setDefaultNotificationDuration, showPPTBNotification } from "./notifications";
34+
import { applyPreviewFeaturesVisibility } from "./previewFeatureManagement";
3435
import { openSettingsTab } from "./settingsManagement";
3536
import { switchSidebar } from "./sidebarManagement";
3637
import { handleTerminalClosed, handleTerminalCommandCompleted, handleTerminalCreated, handleTerminalError, handleTerminalOutput, setupTerminalPanel } from "./terminalManagement";
37-
import { applyDebugMenuVisibility, applyPreviewFeaturesVisibility, applyTerminalFont, applyTheme } from "./themeManagement";
38+
import { applyDebugMenuVisibility, applyTerminalFont, applyTheme } from "./themeManagement";
3839
import {
3940
applyAppearanceSettings,
4041
closeAllTools,
@@ -251,7 +252,7 @@ function setupActivityBar(): void {
251252
}
252253

253254
// Agent invocation logs button opens a tab
254-
const agentInvocationLogsBtn = document.getElementById("agent-invocation-logs-btn");
255+
const agentInvocationLogsBtn = document.getElementById("mcp-btn");
255256
if (agentInvocationLogsBtn) {
256257
agentInvocationLogsBtn.addEventListener("click", () => {
257258
openAgentInvocationLogsTab().catch((err) => {

src/renderer/modules/mcpManagement.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export function renderMCPServerContent(panel: HTMLElement): void {
9393
</div>
9494
</div>
9595
96-
<div id="agent-invocation-logs-container" class="invocation-logs-container">
97-
<div class="empty-state" id="agent-invocation-logs-empty" style="display: none;">
96+
<div id="mcp-container" class="invocation-logs-container">
97+
<div class="empty-state" id="mcp-empty" style="display: none;">
9898
<p>No agent invocations recorded yet.</p>
9999
<p class="empty-state-hint">Invoke tools through the MCP server to see activity here.</p>
100100
</div>
@@ -143,8 +143,8 @@ function getOutcomeBadgeStyle(outcome: string): string {
143143
async function loadAndRenderLogs(): Promise<void> {
144144
try {
145145
const [serverDetails, logs] = await Promise.all([window.toolboxAPI.mcpServer.getDetails(), window.toolboxAPI.agentInvocation.getLogs()]);
146-
const container = document.getElementById("agent-invocation-logs-container");
147-
const emptyState = document.getElementById("agent-invocation-logs-empty");
146+
const container = document.getElementById("mcp-container");
147+
const emptyState = document.getElementById("mcp-empty");
148148
const table = document.getElementById("invocation-logs-table");
149149
const tbody = document.getElementById("invocation-logs-tbody");
150150
const statusLabel = document.getElementById("mcp-server-status");
@@ -202,7 +202,7 @@ async function loadAndRenderLogs(): Promise<void> {
202202
.join("");
203203
} catch (error) {
204204
logError("Failed to load agent invocation logs", error);
205-
const container = document.getElementById("agent-invocation-logs-container");
205+
const container = document.getElementById("mcp-container");
206206
if (container) {
207207
container.innerHTML = `<div class="empty-state"><p>Error loading logs</p><p class="empty-state-hint">${escapeHtml(error instanceof Error ? error.message : String(error))}</p></div>`;
208208
}
@@ -321,8 +321,8 @@ function escapeHtml(text: string): string {
321321
* Open agent invocation logs as a tab
322322
*/
323323
export async function openAgentInvocationLogsTab(): Promise<void> {
324-
registerCloseGuard("agent-invocation-logs", async () => {
324+
registerCloseGuard("mcp", async () => {
325325
return true;
326326
});
327-
await openLocalPageAsTab("agent-invocation-logs", "MCP Server", renderMCPServerContent, "");
327+
await openLocalPageAsTab("mcp", "MCP Server", renderMCPServerContent, "");
328328
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Apply preview features visibility setting
3+
* Controls visibility of preview-gated items (e.g. the MCP Server button)
4+
*/
5+
export function applyPreviewFeaturesVisibility(enablePreviewFeatures: boolean): void {
6+
const mcpButton = document.getElementById("mcp-btn") as HTMLElement | null;
7+
if (mcpButton) {
8+
mcpButton.style.display = enablePreviewFeatures ? "" : "none";
9+
}
10+
}

src/renderer/modules/settingsManagement.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
import type { SettingsState } from "../types/index";
1818
import { loadMarketplace } from "./marketplaceManagement";
1919
import { setDefaultNotificationDuration } from "./notifications";
20-
import { applyDebugMenuVisibility, applyPreviewFeaturesVisibility, applyTerminalFont, applyTheme } from "./themeManagement";
20+
import { applyPreviewFeaturesVisibility } from "./previewFeatureManagement";
21+
import { applyDebugMenuVisibility, applyTerminalFont, applyTheme } from "./themeManagement";
2122
import { applyAppearanceSettings, openLocalPageAsTab, registerCloseGuard } from "./toolManagement";
2223
import { loadSidebarTools } from "./toolsSidebarManagement";
2324

src/renderer/modules/themeManagement.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,3 @@ export function applyDebugMenuVisibility(showDebugMenu: boolean): void {
317317
debugActivityItem.style.display = showDebugMenu ? "" : "none";
318318
}
319319
}
320-
321-
/**
322-
* Apply preview features visibility setting
323-
* Controls visibility of preview-gated items (e.g. the MCP Server button)
324-
*/
325-
export function applyPreviewFeaturesVisibility(enablePreviewFeatures: boolean): void {
326-
const mcpButton = document.getElementById("agent-invocation-logs-btn") as HTMLElement | null;
327-
if (mcpButton) {
328-
mcpButton.style.display = enablePreviewFeatures ? "" : "none";
329-
}
330-
}

0 commit comments

Comments
 (0)