get_random_photo
Retrieve a random photo from a unified MCP server, optionally filtered by category. Access multiple APIs through Multi-MCPs to simplify photo retrieval across integrated services.
Instructions
Get a random photo optionally filtered by category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No |
Implementation Reference
- src/apis/unsplash/unsplash.ts:70-74 (handler)The main handler function for the 'get_random_photo' tool. It validates the Unsplash access key configuration, extracts the optional 'category' parameter from the input arguments, converts it to a string if present, and delegates to the Unsplash client's getRandomPhoto method to fetch the photo.async get_random_photo(args: Record<string, unknown>) { if (!cfg.unsplashAccessKey) throw new Error("UNSPLASH_ACCESS_KEY is not configured"); const category = args.category ? String(args.category) : undefined; return client.getRandomPhoto(category); },
- src/apis/unsplash/unsplash.ts:47-50 (schema)Input schema definition for the 'get_random_photo' tool, specifying an optional 'category' property of type string.inputSchema: { type: "object", properties: { category: { type: "string" } }, },
- src/apis/unsplash/unsplash.ts:44-51 (registration)Tool registration entry for 'get_random_photo' within the tools array returned by the registerUnsplash function.{ name: "get_random_photo", description: "Get a random photo optionally filtered by category", inputSchema: { type: "object", properties: { category: { type: "string" } }, }, },
- src/apis/unsplash/unsplash.ts:20-22 (helper)Supporting helper method in the UnsplashClient class that makes the API request to Unsplash's /photos/random endpoint, optionally passing a category as a query parameter.getRandomPhoto(category?: string) { return this.request("/photos/random", { headers: this.headers(), query: category ? { query: category } : undefined }); }