pocket_mark_as_read
Mark a Pocket article as read (archived) by providing its item ID, streamlining your saved article management and keeping your Pocket list organized.
Instructions
Marks a specific Pocket article as read (archived) using its item ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes |
Implementation Reference
- pocket.ts:63-87 (handler)Core implementation of the tool: sends a POST request to Pocket API to archive (mark as read) the specified item ID.export async function markAsRead(config: PocketConfig, itemId: string) { const response = await fetch("https://getpocket.com/v3/send", { method: "POST", headers: { "Content-Type": "application/json; charset=UTF-8", "X-Accept": "application/json", }, body: JSON.stringify({ consumer_key: config.consumerKey, access_token: config.accessToken, actions: [ { action: "archive", item_id: itemId, }, ], }), }); if (!response.ok) { throw new Error(`Failed to mark article as read: ${response.statusText}`); } return true; }
- index.ts:127-162 (handler)MCP tool dispatch handler: validates input, calls the markAsRead function, and formats the response.case "pocket_mark_as_read": { if (!config.pocket) { throw new Error("Pocket API configuration is not available"); } const parsed = MarkAsReadSchema.safeParse(args); if (!parsed.success) { throw new Error( `Invalid arguments for pocket_mark_as_read: ${parsed.error}`, ); } try { await markAsRead(config.pocket, parsed.data.itemId); return { content: [ { type: "text", text: `Successfully marked article ${parsed.data.itemId} as read`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Pocket API Error: ${errorMessage}`, }, ], isError: true, }; } }
- index.ts:37-39 (schema)Zod schema for validating the tool input: requires an itemId string.const MarkAsReadSchema = z.object({ itemId: z.string(), });
- index.ts:68-73 (registration)Tool registration in the listTools response, including name, description, and input schema.{ name: "pocket_mark_as_read", description: "Marks a specific Pocket article as read (archived) using its item ID.", inputSchema: zodToJsonSchema(MarkAsReadSchema) as ToolInput, },