Skip to main content
Glama
list.ts1.39 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { registerStructuredTool } from '../../patch'; import { listLabels } from 'knbn-core/actions/label'; import { pcwd } from 'knbn-core/utils/files'; import { Brands } from 'knbn-core/utils/ts'; import { z } from 'zod'; import * as path from 'path'; export const registerListLabelsTool = (server: McpServer) => registerStructuredTool(server, 'list_labels', { title: 'List KnBn Labels', description: 'List all labels in a KnBn board', inputSchema: { filename: z.string().optional().describe('Board filename (defaults to .knbn)'), }, outputSchema: { labels: z.array(z.object({ name: z.string(), color: z.string().optional(), })), }, annotations: { readOnlyHint: true, }, }, async (args) => { try { const filename = args.filename || '.knbn'; const filepath = Brands.Filepath(path.join(pcwd(), filename)); const labels = listLabels(filepath); return { structuredContent: { labels, }, }; } catch (error: any) { return { isError: true, content: [{ type: 'text', text: error?.message || error || 'Unknown error listing labels' }], }; } } );

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