({ queries, format }: z.infer<typeof this.schema>)
| 194 | } |
| 195 | |
| 196 | async execute({ queries, format }: z.infer<typeof this.schema>) { |
| 197 | console.log( |
| 198 | `[${LOGO_TOOL_NAME}] Starting logo search for: ${queries.join( |
| 199 | ", " |
| 200 | )} in ${format} format` |
| 201 | ); |
| 202 | try { |
| 203 | // Process all queries |
| 204 | const results = await Promise.all( |
| 205 | queries.map(async (query) => { |
| 206 | try { |
| 207 | console.log(`[${LOGO_TOOL_NAME}] Fetching logos for ${query}...`); |
| 208 | const logos = await this.fetchLogos(query); |
| 209 | |
| 210 | if (logos.length === 0) { |
| 211 | console.log(`[${LOGO_TOOL_NAME}] No logo found for ${query}`); |
| 212 | return { |
| 213 | query, |
| 214 | success: false, |
| 215 | message: `No logo found for: "${query}"`, |
| 216 | }; |
| 217 | } |
| 218 | |
| 219 | const logo = logos[0]; |
| 220 | console.log( |
| 221 | `[${LOGO_TOOL_NAME}] Processing logo for: ${logo.title}` |
| 222 | ); |
| 223 | |
| 224 | const svgUrl = |
| 225 | typeof logo.route === "string" ? logo.route : logo.route.light; |
| 226 | console.log(`[${LOGO_TOOL_NAME}] Fetching SVG from: ${svgUrl}`); |
| 227 | const svgContent = await this.fetchSVGContent(svgUrl); |
| 228 | |
| 229 | console.log(`[${LOGO_TOOL_NAME}] Converting to ${format} format`); |
| 230 | const formattedContent = await this.convertToFormat( |
| 231 | svgContent, |
| 232 | format, |
| 233 | logo.title + "Icon" |
| 234 | ); |
| 235 | |
| 236 | console.log(`[${LOGO_TOOL_NAME}] Successfully processed ${query}`); |
| 237 | return { |
| 238 | query, |
| 239 | success: true, |
| 240 | content: `// ${logo.title} (${logo.url})\n${formattedContent}`, |
| 241 | }; |
| 242 | } catch (error) { |
| 243 | console.error( |
| 244 | `[${LOGO_TOOL_NAME}] Error processing ${query}:`, |
| 245 | error |
| 246 | ); |
| 247 | return { |
| 248 | query, |
| 249 | success: false, |
| 250 | message: error instanceof Error ? error.message : "Unknown error", |
| 251 | }; |
| 252 | } |
| 253 | }) |
nothing calls this directly
no test coverage detected