UNPKG

chess-mcp

Version:

Chess MCP server with position evaluation, move validation, and masters database

66 lines 2.01 kB
export const toolSpec = { name: 'generate_chess_position_image', description: 'Generate an image of a chess position', inputSchema: { type: 'object', properties: { fen: { type: 'string', description: 'Chess position in FEN notation', }, size: { type: 'number', description: 'Size of the board in pixels (default: 400)', minimum: 200, maximum: 1000, }, light: { type: 'string', description: 'Light square color in hex (default: #FFFFFF)', pattern: '^#[0-9a-fA-F]{6}$', }, dark: { type: 'string', description: 'Dark square color in hex (default: #4B7399)', pattern: '^#[0-9a-fA-F]{6}$', }, }, required: ['fen'], }, }; export class GenerateImageHandler { constructor(imageService) { this.imageService = imageService; } async handle(request) { const { fen, size, light, dark } = request.params.arguments; try { const imageBuffer = await this.imageService.generateImage(fen, { size, light, dark, }); return { content: [ { type: 'image', data: imageBuffer.toString('base64'), mimeType: 'image/png', }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } } } //# sourceMappingURL=generate-image.handler.js.map