Skip to main content
Glama

logo_search

Search and retrieve company logos in JSX, TSX, or SVG format using natural language queries. Filter by categories and themes, generate React components, and integrate logos into projects with ease.

Instructions

Search and return logos in specified format (JSX, TSX, SVG). Supports single and multiple logo searches with category filtering. Can return logos in different themes (light/dark) if available.

When to use this tool:

  1. When user types "/logo" command (e.g., "/logo GitHub")

  2. When user asks to add a company logo that's not in the local project

Example queries:

  • Single company: ["discord"]

  • Multiple companies: ["discord", "github", "slack"]

  • Specific brand: ["microsoft office"]

  • Command style: "/logo GitHub" -> ["github"]

  • Request style: "Add Discord logo to the project" -> ["discord"]

Format options:

  • TSX: Returns TypeScript React component

  • JSX: Returns JavaScript React component

  • SVG: Returns raw SVG markup

Each result includes:

  • Component name (e.g., DiscordIcon)

  • Component code

  • Import instructions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYesOutput format
queriesYesList of company names to search for logos

Implementation Reference

  • The main handler method that executes the logo_search tool: fetches logos from SVGL API, converts SVG to requested format (JSX/TSX/SVG), handles multiple queries, saves test results, and returns structured JSON response with icons and setup instructions.
    async execute({ queries, format }: z.infer<typeof this.schema>) {
      console.log(
        `[${LOGO_TOOL_NAME}] Starting logo search for: ${queries.join(
          ", "
        )} in ${format} format`
      );
      try {
        // Process all queries
        const results = await Promise.all(
          queries.map(async (query) => {
            try {
              console.log(`[${LOGO_TOOL_NAME}] Fetching logos for ${query}...`);
              const logos = await this.fetchLogos(query);
    
              if (logos.length === 0) {
                console.log(`[${LOGO_TOOL_NAME}] No logo found for ${query}`);
                return {
                  query,
                  success: false,
                  message: `No logo found for: "${query}"`,
                };
              }
    
              const logo = logos[0];
              console.log(
                `[${LOGO_TOOL_NAME}] Processing logo for: ${logo.title}`
              );
    
              const svgUrl =
                typeof logo.route === "string" ? logo.route : logo.route.light;
              console.log(`[${LOGO_TOOL_NAME}] Fetching SVG from: ${svgUrl}`);
              const svgContent = await this.fetchSVGContent(svgUrl);
    
              console.log(`[${LOGO_TOOL_NAME}] Converting to ${format} format`);
              const formattedContent = await this.convertToFormat(
                svgContent,
                format,
                logo.title + "Icon"
              );
    
              console.log(`[${LOGO_TOOL_NAME}] Successfully processed ${query}`);
              return {
                query,
                success: true,
                content: `// ${logo.title} (${logo.url})\n${formattedContent}`,
              };
            } catch (error) {
              console.error(
                `[${LOGO_TOOL_NAME}] Error processing ${query}:`,
                error
              );
              return {
                query,
                success: false,
                message: error instanceof Error ? error.message : "Unknown error",
              };
            }
          })
        );
    
        // Prepare summary
        const successful = results.filter((r) => r.success);
        const failed = results.filter((r) => !r.success);
    
        console.log(`[${LOGO_TOOL_NAME}] Results summary:`);
        console.log(
          `[${LOGO_TOOL_NAME}] Successfully processed: ${successful.length}`
        );
        console.log(`[${LOGO_TOOL_NAME}] Failed to process: ${failed.length}`);
    
        // Save test results
        await this.saveTestResult({
          queries,
          format,
          successful: successful
            .filter(
              (r): r is typeof r & { content: string } => r.content !== undefined
            )
            .map((r) => ({
              query: r.query,
              content: r.content,
            })),
          failed: failed
            .filter(
              (r): r is typeof r & { message: string } => r.message !== undefined
            )
            .map((r) => ({
              query: r.query,
              message: r.message,
            })),
        });
    
        // Format response as component structure
        const foundIcons = successful.map((r) => {
          const title =
            r.content?.split("\n")[0].replace("// ", "").split(" (")[0] || "";
          const componentName =
            title
              .split(" ")
              .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
              .join("")
              .replace(/[^a-zA-Z0-9]/g, "") + "Icon";
    
          return {
            icon: componentName,
            code: r.content?.split("\n").slice(1).join("\n") || "",
          };
        });
    
        const missingIcons = failed.map((f) => ({
          icon: f.query,
          alternatives: [
            "Search for SVG version on the official website",
            "Check other icon libraries (e.g., heroicons, lucide)",
            "Request SVG file from the user",
          ],
        }));
    
        const response = {
          icons: foundIcons,
          notFound: missingIcons,
          setup: [
            "1. Add these icons to your project:",
            foundIcons
              .map((c) => `   ${c.icon}.${format.toLowerCase()}`)
              .join("\n"),
            "2. Import and use like this:",
            "```tsx",
            "import { " +
              foundIcons.map((c) => c.icon).join(", ") +
              " } from '@/icons';",
            "```",
          ].join("\n"),
        };
    
        // Log results
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        // Log error
        console.error(`[${LOGO_TOOL_NAME}] Error:`, error);
        throw error;
      }
    }
  • Zod schema defining the input parameters: array of company name queries and output format (JSX, TSX, or SVG). Includes tool name 'logo_search' and detailed description.
    schema = z.object({
      queries: z
        .array(z.string())
        .describe("List of company names to search for logos"),
      format: z.enum(["JSX", "TSX", "SVG"]).describe("Output format"),
    });
  • src/index.ts:15-15 (registration)
    Registration of the LogoSearchTool instance with the MCP server.
    new LogoSearchTool().register(server);
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns logos in specified formats, supports single/multiple searches with category filtering, and can provide themes if available. However, it lacks details on error handling, rate limits, or authentication needs, leaving some behavioral aspects unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, usage guidelines, examples, format options, result details) and uses bullet points for readability. It is appropriately sized but includes some redundancy (e.g., repeating format options in the first sentence and a dedicated section), which slightly reduces efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (2 parameters, no output schema, no annotations), the description is mostly complete: it covers purpose, usage, examples, formats, and result details. However, it lacks information on error cases, pagination, or response structure, which could be important for a search tool. The absence of an output schema means the description should ideally explain return values more thoroughly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the baseline is 3. The description adds minimal value beyond the schema by mentioning 'category filtering' (implied in queries) and 'themes if available' (not in schema), but it does not provide additional syntax or format details for parameters. It compensates slightly by explaining format options and result components, but parameter-specific semantics are limited.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Search and return logos') and resources ('logos in specified format'), distinguishing it from sibling tools like component builders by focusing on logo retrieval rather than creation or inspiration. It explicitly mentions the supported formats (JSX, TSX, SVG) and capabilities like category filtering and theme options.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool, including specific triggers like '/logo' commands and requests to add company logos not in the local project. It also offers example queries (e.g., single/multiple companies, command style) that clarify appropriate contexts, though it does not explicitly state when NOT to use it or mention alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/oyasimi1209/magic-mcp'

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