Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

jsonplaceholder_albums

Retrieve test album data from JSONPlaceholder for development and testing purposes, filtering by user ID and limiting results as needed.

Instructions

Get test albums data from JSONPlaceholder

Input Schema

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

Implementation Reference

  • The execute handler function that calls the API client to fetch albums data and formats the response.
    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' }; } }
  • Full tool registration block defining name, description, input schema, and 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 and fetches albums data.
    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; }
  • Zod input validation schema specific to the jsonplaceholder_albums tool.
    'jsonplaceholder_albums': z.object({ userId: z.number().int().min(1).max(10).optional(), limit: z.number().int().min(1).max(100).optional().default(10) }),
  • src/index.ts:245-245 (registration)
    Top-level call to register the JSONPlaceholder tools including jsonplaceholder_albums.
    registerJSONPlaceholderTools(this.toolRegistry); // 2 tools: test_jsonplaceholder, test_httpbin

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