Skip to main content
Glama
create.ts1.61 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { registerStructuredTool } from '../../patch'; import path from 'path'; import { getFilenameFromBoardName, getFilepathForBoardFile, pcwd } from 'knbn-core/utils/files'; import { createBoard } from 'knbn-core/actions/board'; import { z } from 'zod'; import { zknbn } from '../../zod/output'; export const registerCreateBoardTool = (server: McpServer) => registerStructuredTool(server, 'create_board', { title: 'Create KnBn Board', description: 'Create a new .knbn board file', inputSchema: { name: z.string().describe('Board name'), description: z.string().optional().nullish().describe('Board description'), filename: z.string().optional().describe('Custom filename (defaults to .knbn)'), }, outputSchema: { filename: z.string(), board: zknbn.board, }, }, async (args) => { try { const filepath = getFilepathForBoardFile(getFilenameFromBoardName(args.name)); const board = createBoard(filepath, { name: args.name, description: args.description ?? undefined, }); const filename = path.basename(filepath); return { structuredContent: { filename, board, }, }; } catch (error: any) { return { isError: true, content: [{ type: 'text', text: `Error creating board: ${error.message || error || 'Unknown error creating board'}`, }] } } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mattbalmer/knbn-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server