Skip to main content
Glama

scan_gmail_years

Scan one or more COMPLETED PRIOR years of the user's Gmail for receipts (e.g. years:[2023] or years:[2020,2021,2022]). Long-running background job: the first eligible year starts immediately and the rest queue, running one at a time (each full year typically takes a couple of hours; the user can close the app). ALWAYS call first WITHOUT confirmStart to preview which years are eligible, then ask the user to confirm, then call again with confirmStart:true. For receipts from the last ~60 days use scan_gmail instead. To check how a scan is going, use get_scan_status. The current in-progress year cannot be year-scanned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearsYesCompleted prior years to scan, e.g. [2020, 2021]. Max 10.
accountEmailNoOptional: which connected Gmail inbox to scan (multi-inbox users). Defaults to the primary.
confirmStartNoOmit or false = preview only (no scan starts). Must be exactly true to start scanning.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNo
messageYes
previewNo
successYes
eligibleNo
gmailUrlNo
scanningNo
notEligibleNo
queuedYearsNo
startedYearNo
alreadyQueuedNo
alreadyScannedNo
archiveThroughYearNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "allOf": [
      +    {
      +      "if": {
      +        "properties": {
      +          "preview": {
      +            "const": true
      +          }
      +        },
      +        "required": [
      +          "preview"
      +        ]
      +      },
      +      "then": {
      +        "required": [
      +          "account",
      +          "eligible",
      +          "alreadyScanned",
      +          "notEligible"
      +        ]
      +      }
      +    }
      +  ],
      +  "properties": {
      +    "account": {
      +      "type": "string"
      +    },
      +    "alreadyQueued": {
      +      "items": {
      +        "type": "integer"
      +      },
      +      "type": "array"
      +    },
      +    "alreadyScanned": {
      +      "items": {
      +        "type": "integer"
      +      },
      +      "type": "array"
      +    },
      +    "archiveThroughYear": {
      +      "type": "integer"
      +    },
      +    "eligible": {
      +      "items": {
      +        "type": "integer"
      +      },
      +      "type": "array"
      +    },
      +    "gmailUrl": {
      +      "type": "string"
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "notEligible": {
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "code": {
      +            "type": "string"
      +          },
      +          "reason": {
      +            "type": "string"
      +          },
      +          "year": {
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "year",
      +          "reason"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "preview": {
      +      "type": "boolean"
      +    },
      +    "queuedYears": {
      +      "items": {
      +        "type": "integer"
      +      },
      +      "type": "array"
      +    },
      +    "scanning": {
      +      "items": {
      +        "type": "integer"
      +      },
      +      "type": "array"
      +    },
      +    "startedYear": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "success": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success",
      +    "message"
      +  ],
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "description": "Standard ExpenseBot tool result envelope. `message` is the human-readable summary the AI cites; `data` is the structured payload (totals, breakdowns, ids, etc.). On failure, `success` is false and `error` carries a code/message/hint triple.",
      -  "properties": {
      -    "data": {
      -      "additionalProperties": true,
      -      "description": "Structured payload. Shape varies per tool — common keys: total, breakdown, comparison, sampleMeta, ids, expenseId, reportId, signupUrl, results.",
      -      "type": "object"
      -    },
      -    "error": {
      -      "additionalProperties": true,
      -      "description": "Present only when success === false.",
      -      "properties": {
      -        "code": {
      -          "type": "string"
      -        },
      -        "hint": {
      -          "type": "string"
      -        },
      -        "message": {
      -          "type": "string"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "message": {
      -      "description": "Human-readable result text. Always present on success; prefer rendering this verbatim before any further reasoning.",
      -      "type": "string"
      -    },
      -    "sampleMeta": {
      -      "additionalProperties": true,
      -      "description": "Set when the underlying dataset was truncated. isTruncated=true means the agent saw a sample of `sampleCount` of `totalCount` rows; aggregate totals are still accurate.",
      -      "properties": {
      -        "isTruncated": {
      -          "type": "boolean"
      -        },
      -        "sampleCount": {
      -          "type": "integer"
      -        },
      -        "totalCount": {
      -          "type": "integer"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "success": {
      -      "description": "False on tool errors; check before reading `data`.",
      -      "type": "boolean"
      -    }
      -  },
      -  "type": "object"
      -}New value: +null
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

The description discloses that this is a long-running background job, that years queue and run one at a time, that each year takes a couple of hours, that the user can close the app, and that the current in-progress year cannot be year-scanned. These behavioral traits go well beyond the annotations (readOnlyHint=false, openWorldHint=true, destructiveHint=false) and give the agent critical operational context.

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 dense but every sentence earns its place: scope, timing, queueing behavior, call sequence, sibling routing, and an exclusion constraint. It is front-loaded with the core purpose and immediately gives the critical usage pattern. No fluff.

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

Completeness5/5

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

Given the tool's complexity (long-running, queued, multi-step confirmation), the description covers everything an agent needs: what it does, when to use it, how to invoke it safely, what to expect, and how to monitor it. The output schema exists, so return values need no description. This is complete.

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?

Schema coverage is 100%, so the schema already documents all three parameters. The description adds meaning by explaining the confirmStart preview-then-confirm workflow and the constraint that the current in-progress year cannot be scanned. It doesn't add much about accountEmail, but the schema covers it. Baseline 3 plus the confirmStart workflow context justifies a 4.

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 scans completed prior years of Gmail for receipts, with a specific verb and resource. It distinguishes itself from scan_gmail by noting the ~60-day boundary, and from get_scan_status for monitoring. The title 'Scan past years of Gmail' reinforces the purpose.

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 when-to-use guidance: use for completed prior years, use scan_gmail for last ~60 days, use get_scan_status to check progress. It also gives a precise call sequence: first call without confirmStart to preview, then confirm with the user, then call with confirmStart:true. This is exemplary usage guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.