Skip to main content
Glama
saveToDailyNote.ts1.88 kB
import { z } from "zod"; import { makeApiRequest } from "../api.js"; export const saveToDailyNoteTool = { annotations: { openWorldHint: true, readOnlyHint: false, title: "Save to Daily Note", }, description: "Add markdown text to today's daily note in a Capacities space", execute: async (args: { spaceId: string; mdText: string; origin?: "commandPalette"; noTimestamp?: boolean; }) => { try { const requestBody = { spaceId: args.spaceId, mdText: args.mdText, ...(args.origin && { origin: args.origin }), ...(args.noTimestamp !== undefined && { noTimestamp: args.noTimestamp, }), }; const response = await makeApiRequest("/save-to-daily-note", { method: "POST", body: JSON.stringify(requestBody), }); // Check if response has content before parsing JSON const responseText = await response.text(); if (!responseText.trim()) { return "Success: Content saved to daily note (no response data)"; } try { const data = JSON.parse(responseText); return JSON.stringify(data, null, 2); } catch (parseError) { return `Success: Content saved to daily note. Response: ${responseText}`; } } catch (error) { throw new Error( `Failed to save to daily note: ${error instanceof Error ? error.message : String(error)}`, ); } }, name: "capacities_save_to_daily_note", parameters: z.object({ spaceId: z .string() .uuid() .describe("The UUID of the space to save to the daily note"), mdText: z .string() .max(200000) .describe("The markdown text to add to today's daily note"), origin: z .enum(["commandPalette"]) .optional() .describe( "Optional origin label for the content (only 'commandPalette' is supported)", ), noTimestamp: z .boolean() .optional() .describe("If true, no time stamp will be added to the note"), }), };

Implementation Reference

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/Im-Hal-9K/Capacities-MCP-Plus'

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