Skip to main content
Glama

create_card

Create new cards in Codecks project management with configurable properties like title, content, deck assignment, and hierarchical nesting options.

Instructions

Create a new card. Set deck/project to place it. Use parent to nest as sub-card.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesCard title (max 500 chars)
contentNoCard body. Use '- []' for checkboxes
deckNoDestination deck name
projectNo
severityNo
docNoTrue for doc card
allow_duplicateNo
parentNoParent card UUID for sub-cards

Implementation Reference

  • Complete MCP tool registration for 'create_card', including Zod input schema validation (lines 25-34) and the async handler function (lines 36-62) that validates inputs and calls client.createCard()
    export function registerMutationTools(server: McpServer, client: CodecksClient): void { server.registerTool( "create_card", { title: "Create Card", description: "Create a new card. Set deck/project to place it. Use parent to nest as sub-card.", inputSchema: z.object({ title: z.string().describe("Card title (max 500 chars)"), content: z.string().optional().describe("Card body. Use '- []' for checkboxes"), deck: z.string().optional().describe("Destination deck name"), project: z.string().optional(), severity: z.enum(["critical", "high", "low", "null"]).optional(), doc: z.boolean().default(false).describe("True for doc card"), allow_duplicate: z.boolean().default(false), parent: z.string().optional().describe("Parent card UUID for sub-cards"), }), }, async (args) => { try { const title = validateInput(args.title, "title"); const content = args.content ? validateInput(args.content, "content") : undefined; const result = await client.createCard({ title, content, deck: args.deck, project: args.project, severity: args.severity, doc: args.doc, allowDuplicate: args.allow_duplicate, parent: args.parent, }); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } }, );
  • Core implementation of createCard method that constructs the payload with title/content, handles severity and doc card type, dispatches to 'cards/create' API endpoint, and returns the created card ID
    async createCard(options: { title: string; content?: string; deck?: string; project?: string; severity?: string; doc?: boolean; allowDuplicate?: boolean; parent?: string; }): Promise<Record<string, unknown>> { const payload: Record<string, unknown> = { content: `# ${options.title}${options.content ? "\n\n" + options.content : ""}`, }; if (options.severity && options.severity !== "null") { payload.severity = options.severity; } if (options.doc) payload.cardType = "doc"; const result = await dispatch("cards/create", payload); const cardId = (result.payload as Record<string, unknown>)?.id ?? result.cardId ?? "unknown"; return { ok: true, card_id: cardId, title: options.title }; }
  • Input validation helper function used by create_card handler to sanitize text and enforce maximum length limits
    export function validateInput(text: string, field: string): string { if (typeof text !== "string") { throw new CliError(`[ERROR] ${field} must be a string`); } const cleaned = text.replace(CONTROL_RE, ""); const limit = INPUT_LIMITS[field] ?? 50_000; if (cleaned.length > limit) { throw new CliError(`[ERROR] ${field} exceeds maximum length of ${limit} characters`); } return cleaned; }
  • dispatch function that routes API requests to the backend, used by createCard to send 'cards/create' commands
    export async function dispatch(path: string, data: unknown): Promise<Record<string, unknown>> { return sessionRequest(`/dispatch/${path}`, data); }
  • finalizeToolResult helper that normalizes the tool response format, used to format create_card results before returning to MCP client
    export function finalizeToolResult(result: unknown): unknown { if (result !== null && typeof result === "object" && !Array.isArray(result)) { const dict = result as Record<string, unknown>; const normalized = ensureContractDict(dict); if (normalized.ok === false) return normalized; if (config.mcpResponseMode === "envelope") { const data = { ...normalized }; delete data.ok; delete data.schema_version; return { ok: true, schema_version: CONTRACT_SCHEMA_VERSION, data, }; } return normalized; }

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/rangogamedev/codecks-mcp'

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