updateHighlight
Modify existing highlights in Raindrop.io by updating text, color, or notes for better organization and clarity of saved bookmarks.
Instructions
Update an existing highlight
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | New color | |
| id | Yes | Highlight ID | |
| note | No | New note | |
| text | No | New highlighted text |
Implementation Reference
- MCP tool handler for 'highlight_manage' tool. The 'update' operation case constructs the payload and calls the updateHighlight helper on the RaindropService. This is the entry point for updating highlights via the MCP protocol.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)}`); } }
- Core service method that performs the actual HTTP PUT request to the Raindrop.io API to update a highlight by ID with optional text, note, or color changes.async updateHighlight(id: number, updates: { text?: string; note?: string; color?: string; }): Promise<Highlight> { const { data } = await this.client.PUT('/highlights/{id}', { params: { path: { id } }, body: { ...(updates.text && { text: updates.text }), ...(updates.note && { note: updates.note }), ...(updates.color && { color: updates.color as any }) } }); if (!data?.item) throw new Error('Failed to update highlight'); return data.item; }
- src/services/raindropmcp.service.ts:432-438 (registration)Configuration object for the 'highlight_manage' MCP tool, which is later registered in registerDeclarativeTools(). This tool handles updates to highlights using the updateHighlight helper.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 defining input parameters for highlight operations (text, note, color), extended by HighlightManageInputSchema for the MCP tool with operation and id fields.export const HighlightInputSchema = z.object({ bookmarkId: z.number(), text: z.string(), note: z.string().optional(), color: z.string().optional(), });