Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

jsonplaceholder_albums

Retrieve test album data for a specific user or a set of users. Specify a user ID or limit the number of albums returned to streamline data retrieval.

Instructions

Get test albums data from JSONPlaceholder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of albums to return (1-100)
userIdNoUser ID to get albums for (1-10, optional)

Implementation Reference

  • The execute handler function for the jsonplaceholder_albums tool. Fetches albums via the API client, handles errors, and returns structured output with success status, data, and metadata.
    execute: async (args: any) => { try { const albums = await client.getAlbums(args.userId, args.limit || 10); return { success: true, data: { source: 'JSONPlaceholder API', type: 'albums', userId: args.userId, results: albums, count: albums.length, timestamp: Date.now(), apiUsed: true } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get test albums' }; } }
  • Zod schema definition for input validation of the jsonplaceholder_albums tool parameters (userId optional 1-10, limit optional default 10 max 100). Used by the global input validator.
    'jsonplaceholder_albums': z.object({ userId: z.number().int().min(1).max(10).optional(), limit: z.number().int().min(1).max(100).optional().default(10) }),
  • Full tool registration block in registerJSONPlaceholderTools function, defining name, description, category, source, inputSchema, and inline execute handler.
    registry.registerTool({ name: 'jsonplaceholder_albums', description: 'Get test albums data from JSONPlaceholder', category: 'testing', source: 'jsonplaceholder.typicode.com', inputSchema: { type: 'object', properties: { userId: { type: 'number', description: 'User ID to get albums for (1-10, optional)' }, limit: { type: 'number', description: 'Maximum number of albums to return (1-100)', default: 10, minimum: 1, maximum: 100 } }, required: [] }, execute: async (args: any) => { try { const albums = await client.getAlbums(args.userId, args.limit || 10); return { success: true, data: { source: 'JSONPlaceholder API', type: 'albums', userId: args.userId, results: albums, count: albums.length, timestamp: Date.now(), apiUsed: true } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to get test albums' }; } } });
  • Helper method in JSONPlaceholderAPIClient class that constructs the API endpoint for albums, fetches data using makeRequest, and applies optional limit slicing.
    async getAlbums(userId?: number, limit?: number) { const endpoint = userId ? `/users/${userId}/albums` : '/albums'; const albums = await this.makeRequest(endpoint); return limit ? albums.slice(0, limit) : albums; }

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/flyanima/open-search-mcp'

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