mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 00:49:45 +01:00
27 lines
679 B
TypeScript
27 lines
679 B
TypeScript
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
import * as z from 'zod/v4';
|
|
import type { McpServerContext } from '../types.js';
|
|
|
|
export function registerWorkspaceTools(server: McpServer, ctx: McpServerContext) {
|
|
server.registerTool(
|
|
'list_workspaces',
|
|
{
|
|
title: 'List Workspaces',
|
|
description: 'List all open workspaces in Yaak',
|
|
inputSchema: z.object({}),
|
|
},
|
|
async () => {
|
|
const workspaces = await ctx.yaak.workspace.list();
|
|
|
|
return {
|
|
content: [
|
|
{
|
|
type: 'text' as const,
|
|
text: JSON.stringify(workspaces, null, 2),
|
|
},
|
|
],
|
|
};
|
|
},
|
|
);
|
|
}
|