Skip to main content
Glama
IPGeolocation

IP Geolocation MCP Server

User-Agent Parser

parse_user_agent
Read-only

Extract browser, device, OS, and engine details from a user-agent string to identify client software and hardware specifications.

Instructions

Parse an explicit user-agent string via POST /v3/user-agent. Paid only. Cost: 1 credit. Returns browser, device, OS, and engine details.

This MCP tool parses only the uaString you pass. It does not infer a caller user-agent from the MCP transport. For multiple strings, use bulk_parse_user_agent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uaStringYesThe user-agent string to parse (e.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36).
force_refreshNoDefault false. Leave unset unless the user asks to refresh or rerun.

Implementation Reference

  • The handler for the 'parse_user_agent' tool, which handles user-agent parsing with caching and error handling.
    async (params) => {
      try {
        const cacheKey = buildUserAgentCacheKey(params.uaString);
        const cached = params.force_refresh ? undefined : getCachedValue(cacheKey);
        const result =
          cached ??
          (await parseUserAgent({
            uaString: params.uaString,
          }));
        if (cached === undefined) {
          setCachedValue(cacheKey, result);
        }
        return {
          content: [
            { type: "text" as const, text: formatToolResult(result) },
          ],
        };
      } catch (error) {
        return errorToolResponse(error);
      }
    }
  • Registration of the 'parse_user_agent' tool in the MCP server.
      server.registerTool(
        "parse_user_agent",
        {
          title: "User-Agent Parser",
          annotations: {
            readOnlyHint: true,
          },
          description: `Parse an explicit user-agent string via POST /v3/user-agent. Paid only. Cost: 1 credit. Returns browser, device, OS, and engine details.
    
    This MCP tool parses only the uaString you pass. It does not infer a caller user-agent from the MCP transport. For multiple strings, use bulk_parse_user_agent.`,
          inputSchema: {
            uaString: z
              .string()
              .describe(
                "The user-agent string to parse (e.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)."
              ),
            force_refresh: z
              .boolean()
              .optional()
              .describe("Default false. Leave unset unless the user asks to refresh or rerun."),
          },
        },
  • The API client helper function that performs the actual network request to parse a user-agent.
    export async function parseUserAgent(params: {
      uaString: string;
    }): Promise<unknown> {
      return request(
        "/v3/user-agent",
        {},
        { method: "POST", body: { uaString: params.uaString } }
      );
    }
Behavior4/5

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

The description adds valuable behavioral context beyond the readOnlyHint annotation. It discloses cost information ('Paid only. Cost: 1 credit'), specifies the return format ('Returns browser, device, OS, and engine details'), and clarifies the parsing scope ('parses only the uaString you pass'). While the annotation covers safety, the description provides practical operational details that help the agent understand execution implications.

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 efficiently structured with three sentences that each serve distinct purposes: stating the core functionality, providing operational details, and giving sibling differentiation. There's no wasted text, and key information is front-loaded in the first sentence.

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?

For a read-only tool with good annotations and full schema coverage, the description provides excellent contextual completeness. It covers purpose, usage boundaries, cost implications, and return format. The only minor gap is the lack of an output schema, but the description compensates by specifying what gets returned. This is nearly complete for this tool's complexity level.

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?

With 100% schema description coverage, the schema already fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema, but it does provide context about the tool's purpose that helps understand parameter usage. The baseline score of 3 is appropriate when the schema carries the full parameter documentation burden.

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 specific action ('parse an explicit user-agent string'), the resource ('uaString'), and distinguishes it from siblings by specifying it's for single strings only. It explicitly contrasts with 'bulk_parse_user_agent' for multiple strings, making the purpose unambiguous and differentiated.

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 ('parse only the uaString you pass') and when to use an alternative ('For multiple strings, use bulk_parse_user_agent'). It also clarifies what the tool does NOT do ('does not infer a caller user-agent from the MCP transport'), offering clear boundaries for usage.

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/IPGeolocation/ipgeolocation-io-mcp'

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