Skip to main content
Glama
list.ts1.42 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { registerStructuredTool } from '../../patch'; import { pcwd } from 'knbn-core/utils/files'; import { findBoardFiles } from 'knbn-core/actions/board'; import { loadBoardFields } from 'knbn-core/utils/board-files'; import { z } from 'zod'; import path from 'path'; export const registerListBoardsTool = (server: McpServer) => registerStructuredTool(server, 'list_boards', { title: 'List KnBn Boards', description: 'List all .knbn board files in the current directory', outputSchema: { boards: z.object({ filename: z.string(), boardName: z.string(), }).array(), }, annotations: { readOnlyHint: true, }, }, async () => { // call core/boardUtils to list board files const files = findBoardFiles(pcwd()) .map(filepath => path.relative(pcwd(), filepath)); const boardsLimited = files.map(file => { let boardName; try { const board = loadBoardFields(file, ['name']); boardName = board.name || ' -- No Name -- '; } catch (e) { boardName = ' -- Error loading board -- '; } return { filename: file, boardName, }; }); return { structuredContent: { boards: boardsLimited, }, } } );

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