isNewContent
Check if content items from YouTube, blogs, or releases are new by tracking previously seen items across sessions to avoid duplicates.
Instructions
Return true if this content item has NOT been seen before.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| type | Yes |
Implementation Reference
- src/server.ts:174-177 (handler)The execute handler for isNewContent tool, which checks if the given content ID of a specific type has been seen before using hasSeen helper and returns { is_new: true/false }.execute: async ({ id, type }) => JSON.stringify({ is_new: !(await hasSeen(type, id)), }),
- src/server.ts:170-173 (schema)Zod input schema defining parameters: id (string) and type (enum: youtube/blog/release).parameters: z.object({ id: z.string(), type: z.enum(["youtube", "blog", "release"]), }),
- src/server.ts:167-178 (registration)Registration of the isNewContent tool using server.addTool, including name, description, schema, and handler.server.addTool({ name: "isNewContent", description: "Return true if this content item has NOT been seen before.", parameters: z.object({ id: z.string(), type: z.enum(["youtube", "blog", "release"]), }), execute: async ({ id, type }) => JSON.stringify({ is_new: !(await hasSeen(type, id)), }), });
- src/server.ts:55-58 (helper)Core helper function used by the handler to determine if a content ID of given type has been previously seen.async function hasSeen(type: string, id: string) { const data = await loadLastSeen(); return data.seen?.[type]?.includes(id); }