Skip to main content
Glama
benswel

QR for Agent

set_utm_params

Add UTM tracking parameters to QR code URLs to monitor scan analytics in tools like Google Analytics, or remove parameters when needed.

Instructions

Set UTM tracking parameters on a URL QR code. These parameters are automatically appended to the target URL on every scan redirect. Use this to track QR code scans in Google Analytics or other analytics tools. Set 'clear' to true to remove all UTM parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
short_idYesThe short ID of the QR code (must be type='url').
sourceNoutm_source value (e.g. 'flyer', 'email', 'poster').
mediumNoutm_medium value (e.g. 'print', 'qr', 'social').
campaignNoutm_campaign value (e.g. 'summer_2026').
termNoutm_term value (paid search keyword).
contentNoutm_content value (A/B test variant).
clearNoSet to true to remove all UTM parameters from this QR code.

Implementation Reference

  • The handler function for set_utm_params, which constructs the update body and makes the API PATCH request.
    handler: async (input: { short_id: string; source?: string; medium?: string; campaign?: string; term?: string; content?: string; clear?: boolean }) => {
      const body: Record<string, unknown> = {};
      if (input.clear) {
        body.utm_params = null;
      } else {
        const utm: Record<string, string> = {};
        if (input.source) utm.source = input.source;
        if (input.medium) utm.medium = input.medium;
        if (input.campaign) utm.campaign = input.campaign;
        if (input.term) utm.term = input.term;
        if (input.content) utm.content = input.content;
        body.utm_params = utm;
      }
      return apiRequest(`/api/qr/${input.short_id}`, { method: "PATCH", body });
    },
  • The inputSchema definition for set_utm_params using Zod.
    inputSchema: z.object({
      short_id: z.string().describe("The short ID of the QR code (must be type='url')."),
      source: z.string().optional().describe("utm_source value (e.g. 'flyer', 'email', 'poster')."),
      medium: z.string().optional().describe("utm_medium value (e.g. 'print', 'qr', 'social')."),
      campaign: z.string().optional().describe("utm_campaign value (e.g. 'summer_2026')."),
      term: z.string().optional().describe("utm_term value (paid search keyword)."),
      content: z.string().optional().describe("utm_content value (A/B test variant)."),
      clear: z.boolean().optional().describe("Set to true to remove all UTM parameters from this QR code."),
    }),
  • The registration of the set_utm_params tool in the tools object.
    set_utm_params: {
      description:
        "Set UTM tracking parameters on a URL QR code. These parameters are automatically appended to the target URL on every scan redirect. Use this to track QR code scans in Google Analytics or other analytics tools. Set 'clear' to true to remove all UTM parameters.",
      inputSchema: z.object({
        short_id: z.string().describe("The short ID of the QR code (must be type='url')."),
        source: z.string().optional().describe("utm_source value (e.g. 'flyer', 'email', 'poster')."),
        medium: z.string().optional().describe("utm_medium value (e.g. 'print', 'qr', 'social')."),
        campaign: z.string().optional().describe("utm_campaign value (e.g. 'summer_2026')."),
        term: z.string().optional().describe("utm_term value (paid search keyword)."),
        content: z.string().optional().describe("utm_content value (A/B test variant)."),
        clear: z.boolean().optional().describe("Set to true to remove all UTM parameters from this QR code."),
      }),
      handler: async (input: { short_id: string; source?: string; medium?: string; campaign?: string; term?: string; content?: string; clear?: boolean }) => {
        const body: Record<string, unknown> = {};
        if (input.clear) {
          body.utm_params = null;
        } else {
          const utm: Record<string, string> = {};
          if (input.source) utm.source = input.source;
          if (input.medium) utm.medium = input.medium;
          if (input.campaign) utm.campaign = input.campaign;
          if (input.term) utm.term = input.term;
          if (input.content) utm.content = input.content;
          body.utm_params = utm;
        }
        return apiRequest(`/api/qr/${input.short_id}`, { method: "PATCH", body });
      },
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully explains the core behavioral mechanism ('automatically appended to the target URL on every scan redirect') and the clear parameter's effect. However, it omits safety context (overwrite vs. merge behavior), return values, and error conditions.

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?

Four sentences with zero waste: purpose (sentence 1), mechanism (sentence 2), use case (sentence 3), and specific parameter instruction (sentence 4). Information is front-loaded and every sentence earns its place.

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 100% input schema coverage and lack of output schema, the description adequately covers the tool's purpose and mechanism. Minor gap in not describing return values or confirmation behavior, but sufficient for an update operation of this complexity.

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

Parameters4/5

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

Despite 100% schema description coverage (baseline 3), the description adds value by explaining how the parameters function together (appended to URL on redirect) and specifically highlighting the 'clear' parameter's unique behavior, providing semantic context beyond individual field definitions.

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 opens with a specific verb ('Set') and resource ('UTM tracking parameters on a URL QR code'), clearly distinguishing this from sibling tools like update_qr_destination or create_qr_code by focusing specifically on analytics tracking functionality.

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

Usage Guidelines4/5

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

Provides explicit positive guidance ('Use this to track QR code scans in Google Analytics or other analytics tools') and restricts scope to URL QR codes. Lacks explicit negative guidance (e.g., 'do not use for vCard QR codes') or comparisons to alternative approaches, but the use case is clearly defined.

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/benswel/qr-agent-core'

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