Skip to main content
Glama
MiguelAlvRed

Store Scraper MCP

by MiguelAlvRed

gp_permissions

Retrieve Google Play app permissions by providing the app ID. Specify language, country, and format preferences to get detailed or simplified permission lists.

Instructions

[Google Play] Get app permissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesGoogle Play app ID
langNoLanguage code (default: en)en
countryNoTwo-letter country code (default: us)us
shortNoIf true, return only permission names (default: false)

Implementation Reference

  • Main handler function for the 'gp_permissions' tool. Fetches the app's permissions page from Google Play, parses the HTML using parsePermissions, and returns the structured permissions data or error.
    async function handleGPPermissions(args) {
      try {
        const { appId, lang = 'en', country = 'us', short = false } = args;
    
        if (!appId) {
          throw new Error('appId is required');
        }
    
        const url = buildPermissionsUrl({ appId, lang, country });
        const html = await fetchText(url);
        const permissions = parsePermissions(html, short);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                appId,
                permissions,
                count: permissions.length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: error.message }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the gp_permissions tool, specifying parameters like appId (required), lang, country, and short flag.
    inputSchema: {
      type: 'object',
      properties: {
        appId: {
          type: 'string',
          description: 'Google Play app ID',
        },
        lang: {
          type: 'string',
          description: 'Language code (default: en)',
          default: 'en',
        },
        country: {
          type: 'string',
          description: 'Two-letter country code (default: us)',
          default: 'us',
        },
        short: {
          type: 'boolean',
          description: 'If true, return only permission names (default: false)',
          default: false,
        },
      },
      required: ['appId'],
  • Registration/dispatch in the CallToolRequestSchema switch statement that routes calls to the gp_permissions handler.
    case 'gp_permissions':
      return await handleGPPermissions(args);
  • Helper function to construct the Google Play app details URL (which includes permissions data) used by the handler.
    export function buildPermissionsUrl(params) {
      const { appId, lang = 'en', country = 'us' } = params;
      
      if (!appId) {
        throw new Error('appId is required');
      }
    
      return `${GOOGLE_PLAY_BASE}/store/apps/details?id=${appId}&gl=${country}&hl=${lang}`;
    }
  • Core parsing helper that extracts permissions from Google Play app HTML using multiple regex strategies on sections, scripts, meta tags, and text patterns. Supports short mode for names only.
    export function parsePermissions(html, short = false) {
      if (!html || typeof html !== 'string') {
        return [];
      }
    
      const permissions = [];
      const seenPermissions = new Set();
    
      try {
        // Strategy 1: Look for permissions section in HTML
        const permissionsSectionPatterns = [
          /<div[^>]*class=["'][^"']*permissions["'][^>]*>([\s\S]*?)<\/div>/i,
          /<div[^>]*id=["']permissions["'][^>]*>([\s\S]*?)<\/div>/i,
          /<section[^>]*class=["'][^"']*permissions["'][^>]*>([\s\S]*?)<\/section>/i,
          /<div[^>]*data-permissions[^>]*>([\s\S]*?)<\/div>/i,
        ];
    
        for (const pattern of permissionsSectionPatterns) {
          const sectionMatch = html.match(pattern);
          if (sectionMatch) {
            const sectionHtml = sectionMatch[1];
            
            // Extract permission items with multiple patterns
            const permissionItemPatterns = [
              /<div[^>]*class=["'][^"']*permission["'][^>]*>([\s\S]*?)<\/div>/gi,
              /<li[^>]*class=["'][^"']*permission["'][^>]*>([\s\S]*?)<\/li>/gi,
              /<div[^>]*data-permission[^>]*>([\s\S]*?)<\/div>/gi,
            ];
    
            for (const itemPattern of permissionItemPatterns) {
              const permissionMatches = sectionHtml.matchAll(itemPattern);
              
              for (const match of permissionMatches) {
                const permHtml = match[1];
                
                // Extract permission name with multiple patterns
                const namePatterns = [
                  /<div[^>]*class=["'][^"']*permission-name["'][^>]*>([^<]+)<\/div>/i,
                  /<span[^>]*class=["'][^"']*permission-name["'][^>]*>([^<]+)<\/span>/i,
                  /<div[^>]*class=["'][^"']*title["'][^>]*>([^<]+)<\/div>/i,
                  /<span[^>]*>([^<]+)<\/span>/i,
                  /<p[^>]*>([^<]+)<\/p>/i,
                ];
    
                let permissionName = null;
                for (const namePattern of namePatterns) {
                  const nameMatch = permHtml.match(namePattern);
                  if (nameMatch) {
                    permissionName = nameMatch[1].trim();
                    break;
                  }
                }
    
                // Extract permission type/category with multiple patterns
                const typePatterns = [
                  /<div[^>]*class=["'][^"']*permission-type["'][^>]*>([^<]+)<\/div>/i,
                  /<span[^>]*class=["'][^"']*permission-type["'][^>]*>([^<]+)<\/span>/i,
                  /<div[^>]*class=["'][^"']*category["'][^>]*>([^<]+)<\/div>/i,
                  /data-type=["']([^"']+)["']/i,
                ];
    
                let type = '';
                for (const typePattern of typePatterns) {
                  const typeMatch = permHtml.match(typePattern);
                  if (typeMatch) {
                    type = typeMatch[1].trim();
                    break;
                  }
                }
    
                if (permissionName && !seenPermissions.has(permissionName.toLowerCase())) {
                  seenPermissions.add(permissionName.toLowerCase());
                  if (short) {
                    permissions.push(permissionName);
                  } else {
                    permissions.push({
                      permission: permissionName,
                      type: type,
                    });
                  }
                }
              }
            }
          }
        }
    
        // Strategy 2: Extract from script tags with JSON data
        const scriptMatches = html.matchAll(/<script[^>]*>([\s\S]*?)<\/script>/gi);
        
        for (const match of scriptMatches) {
          const scriptContent = match[1];
          
          if (scriptContent.includes('permission') || scriptContent.includes('PERMISSION') || scriptContent.includes('uses-permission')) {
            // Try multiple JSON patterns
            const jsonPatterns = [
              /permissions["']?\s*:\s*\[([\s\S]*?)\]/i,
              /"permissions"["']?\s*:\s*\[([\s\S]*?)\]/i,
              /permissionList["']?\s*:\s*\[([\s\S]*?)\]/i,
              /usesPermissions["']?\s*:\s*\[([\s\S]*?)\]/i,
            ];
    
            for (const pattern of jsonPatterns) {
              const permArrayMatch = scriptContent.match(pattern);
              if (permArrayMatch) {
                const permData = permArrayMatch[1];
                
                // Try to extract permission names
                // Pattern 1: Array of strings
                const stringMatches = permData.matchAll(/"([^"]+)"/g);
                for (const stringMatch of stringMatches) {
                  const permName = stringMatch[1].trim();
                  if (permName && permName.length > 3 && !seenPermissions.has(permName.toLowerCase())) {
                    seenPermissions.add(permName.toLowerCase());
                    if (short) {
                      permissions.push(permName);
                    } else {
                      permissions.push({
                        permission: permName,
                        type: '',
                      });
                    }
                  }
                }
    
                // Pattern 2: Array of objects
                try {
                  const jsonStr = '[' + permData + ']';
                  const jsonData = JSON.parse(jsonStr);
                  if (Array.isArray(jsonData)) {
                    jsonData.forEach(item => {
                      if (typeof item === 'string') {
                        if (!seenPermissions.has(item.toLowerCase())) {
                          seenPermissions.add(item.toLowerCase());
                          if (short) {
                            permissions.push(item);
                          } else {
                            permissions.push({
                              permission: item,
                              type: '',
                            });
                          }
                        }
                      } else if (item && typeof item === 'object') {
                        const permName = item.name || item.permission || item.label || item.title;
                        const permType = item.type || item.category || '';
                        if (permName && !seenPermissions.has(permName.toLowerCase())) {
                          seenPermissions.add(permName.toLowerCase());
                          if (short) {
                            permissions.push(permName);
                          } else {
                            permissions.push({
                              permission: permName,
                              type: permType,
                            });
                          }
                        }
                      }
                    });
                  }
                } catch (e) {
                  // Not valid JSON, continue
                }
              }
            }
          }
        }
    
        // Strategy 3: Extract from meta tags or data attributes
        const metaPermissionMatches = html.matchAll(/<meta[^>]*name=["']permission["'][^>]*content=["']([^"']+)["']/gi);
        for (const metaMatch of metaPermissionMatches) {
          const permName = metaMatch[1].trim();
          if (permName && !seenPermissions.has(permName.toLowerCase())) {
            seenPermissions.add(permName.toLowerCase());
            if (short) {
              permissions.push(permName);
            } else {
              permissions.push({
                permission: permName,
                type: '',
              });
            }
          }
        }
    
        // Strategy 4: Look for common permission patterns in text
        // This is a fallback for when structured data isn't available
        const commonPermissionPatterns = [
          /(?:permission|allows?)\s+(?:the\s+)?(?:app\s+)?(?:to\s+)?(?:access|read|write|modify|delete|use|send|receive|view|get|set|manage|control|change|enable|disable)\s+([^.,!?]+)/gi,
        ];
    
        // Only use this as last resort if we have very few permissions
        if (permissions.length < 3) {
          for (const pattern of commonPermissionPatterns) {
            const matches = html.matchAll(pattern);
            for (const match of matches) {
              const permText = match[1].trim();
              if (permText && permText.length > 5 && permText.length < 100 && !seenPermissions.has(permText.toLowerCase())) {
                seenPermissions.add(permText.toLowerCase());
                if (short) {
                  permissions.push(permText);
                } else {
                  permissions.push({
                    permission: permText,
                    type: '',
                  });
                }
              }
            }
          }
        }
    
        return permissions;
      } catch (error) {
        console.error('Error parsing Google Play permissions:', error);
        return [];
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it's a 'Get' operation, implying read-only behavior, but doesn't clarify if it requires authentication, has rate limits, or what the output format looks like (e.g., list of permissions with details). For a tool with no annotations, this leaves significant gaps in understanding its behavior and constraints.

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 extremely concise and front-loaded: '[Google Play] Get app permissions' in a single phrase. It wastes no words and immediately conveys the core functionality. Every part of the description earns its place by specifying the domain and action.

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 tool's complexity (4 parameters, no output schema, no annotations), the description is insufficient. It doesn't explain what the tool returns (e.g., permission names, descriptions, categories) or behavioral aspects like error handling. For a tool that likely fetches structured data from an external API, more context is needed to guide the agent effectively.

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 description adds no parameter-specific information beyond what the input schema provides. However, schema description coverage is 100%, with clear documentation for all parameters (appId, lang, country, short), including defaults and purposes. This meets the baseline score of 3, as the schema adequately covers parameter semantics without needing additional description.

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 tool's purpose: 'Get app permissions' for Google Play. It specifies the verb ('Get') and resource ('app permissions'), and the domain context ('Google Play') helps distinguish it from generic permission tools. However, it doesn't explicitly differentiate from sibling tools like 'gp_datasafety' or 'privacy', which might also relate to app permissions or safety information.

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 alternatives. It doesn't mention sibling tools like 'gp_datasafety' or 'privacy' that might overlap in functionality, nor does it specify prerequisites or contexts where this tool is preferred. The agent must infer usage based on the tool name and parameters alone.

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/MiguelAlvRed/mobile-store-scraper-mcp'

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