Skip to main content
Glama

createHighlight

Create a new highlight for a bookmark in Raindrop.io by specifying the text and bookmark ID. Add optional color and notes to organize and customize your highlights.

Instructions

Create a new highlight for a bookmark

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNoColor for the highlight (e.g., "yellow", "#FFFF00")
noteNoAdditional note for the highlight
raindropIdYesBookmark ID
textYesHighlighted text

Implementation Reference

  • Core helper function implementing the Raindrop.io API call to create a highlight (POST /highlights). This is the exact API integration logic for creating highlights.
    async createHighlight(bookmarkId: number, highlight: {
      text: string;
      note?: string;
      color?: string;
    }): Promise<Highlight> {
      const { data } = await this.client.POST('/highlights', {
        body: {
          ...highlight,
          raindrop: { $id: bookmarkId },
          color: (highlight.color as any) || 'yellow'
        }
      });
      if (!data?.item) throw new Error('Failed to create highlight');
      return data.item;
    }
  • MCP handler function for the 'highlight_manage' tool. The 'create' operation invokes the createHighlight helper with prepared payload from tool arguments.
    async function handleHighlightManage(args: z.infer<typeof HighlightManageInputSchema>, { raindropService }: ToolHandlerContext) {
        switch (args.operation) {
            case 'create':
                if (!args.bookmarkId || !args.text) throw new Error('bookmarkId and text required for create');
                const createPayload: Record<string, unknown> = { text: args.text };
                setIfDefined(createPayload, 'note', args.note);
                setIfDefined(createPayload, 'color', args.color);
                return await raindropService.createHighlight(args.bookmarkId, createPayload as any);
            case 'update':
                if (!args.id) throw new Error('id required for update');
                const updatePayload: Record<string, unknown> = {};
                setIfDefined(updatePayload, 'text', args.text);
                setIfDefined(updatePayload, 'note', args.note);
                setIfDefined(updatePayload, 'color', args.color);
                return await raindropService.updateHighlight(args.id, updatePayload as any);
            case 'delete':
                if (!args.id) throw new Error('id required for delete');
                await raindropService.deleteHighlight(args.id);
                return { deleted: true };
            default:
                throw new Error(`Unsupported operation: ${String(args.operation)}`);
        }
    }
  • Input schema validation for highlight management tool, extending base HighlightInputSchema with operation type and optional ID.
    const HighlightManageInputSchema = HighlightInputSchema.extend({
        operation: z.enum(['create', 'update', 'delete']),
        id: z.number().optional(),
    });
  • Tool configuration and registration definition for 'highlight_manage', which handles create/update/delete including createHighlight logic.
    const highlightManageTool = defineTool({
        name: 'highlight_manage',
        description: 'Creates, updates, or deletes highlights. Use the operation parameter to specify the action.',
        inputSchema: HighlightManageInputSchema,
        outputSchema: HighlightOutputSchema,
        handler: handleHighlightManage,
    });
  • Base Zod schema for highlight input parameters (bookmarkId, text, note, color), used by HighlightManageInputSchema.
    export const HighlightInputSchema = z.object({
        bookmarkId: z.number(),
        text: z.string(),
        note: z.string().optional(),
        color: z.string().optional(),
    });

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/adeze/raindrop-mcp'

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