MCPcopy Create free account
hub / github.com/chokcoco/iCSS / searchCssDemos

Method searchCssDemos

MCP/server.js:441–508  ·  view source on GitHub ↗
(query, category, difficulty, limit = 5)

Source from the content-addressed store, hash-verified

439 }
440
441 async searchCssDemos(query, category, difficulty, limit = 5) {
442 debugLog(`🎨 Searching CSS demos with query: "${query}"`);
443
444 return new Promise((resolve, reject) => {
445 let sql = `
446 SELECT * FROM css_inspiration
447 WHERE search_content LIKE ?
448 `;
449 let params = [`%${query}%`];
450
451 if (category) {
452 sql += ` AND category = ?`;
453 params.push(category);
454 }
455
456 if (difficulty) {
457 sql += ` AND difficulty_level = ?`;
458 params.push(difficulty);
459 }
460
461 sql += ` ORDER BY title LIMIT ?`;
462 params.push(limit);
463
464 this.db.all(sql, params, (err, rows) => {
465 if (err) {
466 debugLog('❌ Error searching CSS demos:', err);
467 reject(err);
468 return;
469 }
470
471 debugLog(`✅ Found ${rows.length} CSS demos`);
472
473 const formattedResults = rows.map(row => {
474 const tags = JSON.parse(row.tags || '[]');
475 const browserSupport = JSON.parse(row.browser_support || '{}');
476
477 return {
478 id: row.id,
479 title: row.title,
480 category: row.category,
481 difficulty: row.difficulty_level,
482 description: row.description,
483 tags: tags,
484 demo_url: row.demo_url,
485 source_url: row.source_url,
486 browser_support: browserSupport
487 };
488 });
489
490 resolve({
491 content: [
492 {
493 type: 'text',
494 text: `Found ${formattedResults.length} CSS demos for "${query}":\n\n` +
495 formattedResults.map((demo, index) =>
496 `${index + 1}. **${demo.title}** (ID: ${demo.id})\n` +
497 ` 🏷️ Category: ${demo.category} | Difficulty: ${demo.difficulty}\n` +
498 ` 📝 ${demo.description}\n` +

Callers 1

setupHandlersMethod · 0.95

Calls 1

debugLogFunction · 0.70

Tested by

no test coverage detected