Skip to main content
Glama

get_random_photo

Retrieve a random photo for your project, optionally filtered by category, using the Multi-MCPs server's aggregated API access.

Instructions

Get a random photo optionally filtered by category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo

Implementation Reference

  • The handler function for get_random_photo tool. It checks for the Unsplash access key configuration and calls the client's getRandomPhoto method with the optional category parameter extracted from the input arguments.
    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); },
  • Tool registration object for get_random_photo within the Unsplash registration, including name, description, and input schema.
    { name: "get_random_photo", description: "Get a random photo optionally filtered by category", inputSchema: { type: "object", properties: { category: { type: "string" } }, }, },
  • Input schema for the get_random_photo tool, defining an optional 'category' property of type string.
    inputSchema: { type: "object", properties: { category: { type: "string" } }, },
  • UnsplashClient helper method that performs the actual API request to Unsplash for a random photo, using the category as a query parameter if provided.
    getRandomPhoto(category?: string) { return this.request("/photos/random", { headers: this.headers(), query: category ? { query: category } : undefined }); }
  • Invocation of registerUnsplash() in the main tool registration file, which registers the get_random_photo tool among others.
    registerUnsplash(),

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/TaylorChen/muti-mcps'

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