Skip to main content
Glama
WallpaperController.ts928 B
import { WallpaperService } from '../services/WallpaperService'; export class WallpaperController { private wallpaperService: WallpaperService; constructor(wallpaperService: WallpaperService) { this.wallpaperService = wallpaperService; } async getRandomWallpaper(resolution: string = '1920x1080', market: string = 'zh-CN'): Promise<{ content: Array<{ type: 'text'; text: string }> }> { try { const wallpaperInfo = await this.wallpaperService.getRandomWallpaper(resolution, market); return { content: [ { type: 'text' as const, text: JSON.stringify(wallpaperInfo, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `获取壁纸时出错: ${error instanceof Error ? error.message : '未知错误'}`, }, ], }; } } }

Implementation Reference

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/sweetwisdom/mcp-demo'

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