Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions src/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,28 @@ server.tool(
);

// Resources
server.resource(
"browser-status",
new ResourceTemplate("browser-status://current"),
async (uri) => ({
contents: [{
uri: uri.href,
text: state.currentSession
? `Active browser session: ${state.currentSession}`
: "No active browser session"
}]
})
);
server.resource("browser-status", {
uriTemplate: "browser-status://{which}",
list: async () => [
{
uri: "browser-status://current",
name: "Browser Session Status",
description: "Returns the current session ID or status",
mimeType: "text/plain"
}
],
get: async (uri) => {
return {
contents: [{
uri: uri.href,
mimeType: "text/plain",
text: state.currentSession
? `Active session: ${state.currentSession}`
: "No active browser session"
}]
};
}
});

// Cleanup handler
async function cleanup() {
Expand All @@ -477,4 +487,4 @@ process.on('SIGINT', cleanup);

// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);
await server.connect(transport);