// photos' tools (novox/hq ADR 0039), importing photos' own client. import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools"; import { PhotosClient } from "../client.js"; export function getPhotosTools(photos: PhotosClient): ToolDefinition[] { return [ { name: "photos_status", description: "Photo library status: server version and, where the key allows, photo/video counts and storage used.", input: {}, run: async () => { const [server, albums] = await Promise.all([photos.getServerInfo(), photos.getAlbums()]); return { server, albumCount: albums.length }; }, }, { name: "photos_albums", description: "List the albums in the photo library, each with its asset count and whether it is shared.", input: {}, run: async () => { const albums = await photos.getAlbums(); return { count: albums.length, albums }; }, }, { name: "photos_recent", description: "Most recently added assets in the photo library, newest first.", input: { limit: { type: "number", description: "how many assets (default 20)" } }, run: async (args) => ({ items: await photos.getRecentAssets(args.limit ? Number(args.limit) : 20) }), }, ]; } // The tools exist only when an API key is configured; without one, photos contributes none rather // than reaching an unauthenticated endpoint or failing the whole runtime. registerModuleTools("photos", (env) => { try { return getPhotosTools(PhotosClient.fromEnv(env)); } catch { return []; } });