Skip to main content
Glama
kazuph
by kazuph

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
NameRequiredDescriptionDefault
itemIdYes

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;
    }
  • 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,
    		};
    	}
    }
  • 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,
    },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/kazuph/mcp-pocket'

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