Skip to main content
Glama

analyze_logo_candidates

Analyzes all logo candidates on a website to identify and extract logo icons, providing detailed information for each candidate.

Instructions

分析网站的所有Logo候选项并返回详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes要分析的网站URL

Implementation Reference

  • MCP tool handler for 'analyze_logo_candidates'. Validates input URL, extracts candidates using LogoExtractor, computes analysis with scores and recommendation, returns formatted text response.
    private async handleAnalyzeCandidates(args: any) {
      const { url } = args;
    
      if (!url || typeof url !== 'string') {
        throw new Error('请提供有效的网站URL');
      }
    
      const candidates = await this.logoExtractor.extractLogoCandidates(url);
      
      if (candidates.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `未能从网站 ${url} 找到任何Logo候选项。`,
            },
          ],
        };
      }
    
      const analysis = {
        url: url,
        totalCandidates: candidates.length,
        candidates: candidates.map((candidate, index) => ({
          index: index + 1,
          url: candidate.url,
          type: candidate.type,
          source: candidate.source,
          score: candidate.score,
          attributes: candidate.attributes,
        })),
        recommended: this.logoExtractor.selectBestLogo(candidates),
      };
    
      return {
        content: [
          {
            type: 'text',
            text: `Logo候选项分析完成!\n网站: ${url}\n找到 ${candidates.length} 个候选项\n推荐使用: ${analysis.recommended.source} (评分: ${analysis.recommended.score})`,
          },
          {
            type: 'text',
            text: JSON.stringify(analysis, null, 2),
          },
        ],
      };
    }
  • src/index.ts:47-59 (registration)
    Tool registration entry in ListToolsRequestHandler, including name, description, and input schema definition.
      name: 'analyze_logo_candidates',
      description: '分析网站的所有Logo候选项并返回详细信息',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: '要分析的网站URL',
          },
        },
        required: ['url'],
      },
    },
  • TypeScript interface defining the structure of logo candidates used in the analysis.
    export interface LogoCandidate {
      url: string;
      type: 'favicon' | 'apple-touch-icon' | 'og-image' | 'logo-image' | 'brand-image';
      source: string;
      score: number;
      attributes: Record<string, any>;
    }
  • Primary helper method that performs web scraping to find all logo candidates from favicon links, apple icons, OG images, logo imgs, common paths; deduplicates and scores them.
    async extractLogoCandidates(websiteUrl: string): Promise<LogoCandidate[]> {
      try {
        const normalizedUrl = this.normalizeUrl(websiteUrl);
        const response = await axios.get(normalizedUrl, {
          headers: { 'User-Agent': this.userAgent },
          timeout: 10000,
          maxRedirects: 5,
        });
    
        const $ = cheerio.load(response.data);
        const candidates: LogoCandidate[] = [];
        const baseUrl = new URL(normalizedUrl);
    
        // 1. 提取favicon相关链接
        await this.extractFaviconCandidates($, baseUrl, candidates);
    
        // 2. 提取Apple Touch Icon
        await this.extractAppleTouchIcons($, baseUrl, candidates);
    
        // 3. 提取OpenGraph图像
        await this.extractOpenGraphImages($, baseUrl, candidates);
    
        // 4. 提取可能的Logo图像
        await this.extractLogoImages($, baseUrl, candidates);
    
        // 5. 尝试常见的favicon路径
        await this.extractCommonFaviconPaths(baseUrl, candidates);
    
        // 去重并评分
        return this.deduplicateAndScore(candidates);
      } catch (error) {
        console.error(`提取Logo候选项时出错: ${error}`);
        return [];
      }
    }
  • Helper method to select the best logo candidate, prioritizing SVG and highest score.
    selectBestLogo(candidates: LogoCandidate[]): LogoCandidate {
      if (candidates.length === 0) {
        throw new Error('没有可用的Logo候选项');
      }
      
      // 优先选择高分的SVG或高质量PNG
      const sortedCandidates = candidates.sort((a, b) => {
        // SVG格式加分
        const aIsSvg = a.url.toLowerCase().includes('.svg') || a.attributes?.type?.includes('svg');
        const bIsSvg = b.url.toLowerCase().includes('.svg') || b.attributes?.type?.includes('svg');
        
        if (aIsSvg && !bIsSvg) return -1;
        if (!aIsSvg && bIsSvg) return 1;
        
        // 按分数排序
        return b.score - a.score;
      });
      
      return sortedCandidates[0];
    }
Behavior2/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 states the tool analyzes and returns details, but doesn't specify what kind of details, whether it's a read-only operation, potential side effects, rate limits, or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words or fluff. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for a tool that analyzes and returns details. It doesn't explain what '详细信息' (detailed information) includes, such as the structure or type of data returned, leaving the agent uncertain about the output format and content.

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 input schema has 100% description coverage, with the single parameter 'url' clearly documented in the schema. The description doesn't add any additional meaning or context beyond what the schema provides, such as URL format requirements or examples, so it meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('分析' meaning 'analyze') and resource ('网站的所有Logo候选项' meaning 'all logo candidates of a website'), providing a specific purpose. However, it doesn't explicitly differentiate from the sibling tool 'extract_logo', which might have overlapping functionality, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus the sibling 'extract_logo' or any alternatives. It lacks context about prerequisites, exclusions, or specific scenarios for application, leaving the agent with minimal usage direction.

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

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/xtdexw/logo-mcp'

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