Skip to main content
Glama
board.tools.ts2.74 kB
import { Tool } from "@modelcontextprotocol/sdk/types.js"; import { ClickUpService } from "../services/clickup.service.js"; import { logger } from "../logger.js"; import { CreateViewParams, ClickUpView } from "../types.js"; // Tool Definition const commonIdDescription = "The unique identifier for the resource in ClickUp."; export const createBoardTool: Tool = { name: "clickup_create_board", description: "Create a new board view in a ClickUp space.", // Updated description inputSchema: { type: "object", properties: { space_id: { type: "string", description: "The ID of the space to create the board view in. " + commonIdDescription, }, name: { type: "string", description: "Name for the new board view", }, }, required: ["space_id", "name"], }, outputSchema: { type: "object", properties: { board: { type: "object", properties: { id: { type: "string" }, name: { type: "string" }, type: { type: "string" } } } }, description: "An object containing the created board view object in the 'board' property.", }, }; // Type for arguments - align with creating a board view interface CreateBoardArgs { space_id: string; name: string; } // Handler Function export async function handleCreateBoard( clickUpService: ClickUpService, args: Record<string, unknown>, ): Promise<any> { const params = args as unknown as CreateBoardArgs; // Validate required parameters if (!params.space_id || typeof params.space_id !== "string") { throw new Error("Space ID is required and must be a string."); } if (!params.name || typeof params.name !== "string") { throw new Error("Board name is required and must be a string."); } logger.info( `Handling tool call: ${createBoardTool.name} for space ${params.space_id}`, ); try { // Correct implementation: Call createView with type 'board' const viewParams: CreateViewParams = { parent_id: params.space_id, parent_type: "space", name: params.name, type: "board", // Specify the view type as board }; const newView: ClickUpView = await clickUpService.viewService.createView(viewParams); return { content: [ { type: "text", text: JSON.stringify(newView, null, 2), }, ], // AJOUT: structuredContent requis par MCP quand outputSchema est défini structuredContent: { board: newView }, }; } catch (error) { logger.error(`Error in ${createBoardTool.name}:`, error); throw error instanceof Error ? error : new Error("Failed to create board view"); } }

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/Nazruden/clickup-mcp-server'

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