# Compare plan drug costs at a pharmacy

Use this when someone wants plan cost estimates for up to ten exact medications at one confirmed retail pharmacy. Combines medication selection, refill quantity/days supply, branch selection and the website pharmacy-savings calculator. Resume batch_context, preserving other selections and refill details. Return all-medication matches first; partial/unverified matches require agreement. Estimates cover a bounded plan pool, not the entire market; exclude medical costs/subsidy adjustments and may apply a deductible independently per drug. Missing/fallback prices are not free or verified branch quotes. Not a mail-order flow. Use check_plan_drug_coverage for one plan’s formulary or rank_part_d_plans for standalone Part D ranking. An optional website alternative: [TPP’s Pharmacy Savings](https://thepocketprotector.com/tools/pharmacy-savings). Offer only when requested; chat can continue. Opens a separate flow without transferring answers. For another tool, use recommend_website_tool. Use the app as the answer. Do not repeat its options in a list, table or explanation. Ask one short question if input is required; otherwise stop.

## Tool name

`compare_plan_drug_costs`

## Input schema

```json
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "zip": {
      "type": "string",
      "pattern": "^[0-9]{5}$",
      "description": "Residential ZIP for plan availability; reuse known information."
    },
    "county": {
      "type": "string",
      "description": "Confirmed residential county; clarify ambiguous ZIPs."
    },
    "state": {
      "type": "string",
      "pattern": "^[A-Z]{2}$",
      "description": "Two-letter state from the county lookup."
    },
    "plan_year": {
      "type": "integer",
      "minimum": 2024,
      "maximum": 2035,
      "description": "Reuse the requested or previously selected coverage year. If omitted, use the API’s configured serving year and disclose it; do not ask just because the year is missing."
    },
    "drugs": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "medication": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  {
                    "type": "object",
                    "properties": {
                      "query": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 100
                      },
                      "option_id": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "query",
                      "option_id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 100
                      },
                      "strength": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "form": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "release_type": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              "quantity": {
                "type": "integer",
                "minimum": 1,
                "maximum": 999
              },
              "days_supply": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 30
                  },
                  {
                    "type": "number",
                    "const": 60
                  },
                  {
                    "type": "number",
                    "const": 90
                  }
                ]
              }
            },
            "required": [
              "medication"
            ],
            "additionalProperties": false
          },
          {
            "anyOf": [
              {
                "type": "string",
                "minLength": 2,
                "maxLength": 100
              },
              {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  "option_id": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "query",
                  "option_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 100
                  },
                  "strength": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "form": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "release_type": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "additionalProperties": false
              }
            ]
          }
        ]
      },
      "description": "Exact medication references or familiar names. Each refill entry has medication, quantity and days_supply. Ask for missing refill details; do not infer them from a formulary quantity limit."
    },
    "pharmacy": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "search": {
          "type": "object",
          "properties": {
            "zip": {
              "type": "string",
              "pattern": "^\\d{5}$"
            },
            "q": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            },
            "county": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "state": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            "include_farther": {
              "default": false,
              "type": "boolean"
            }
          },
          "required": [
            "zip"
          ],
          "additionalProperties": false
        },
        "option_id": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "search",
        "option_id"
      ],
      "additionalProperties": false,
      "description": "Confirmed pharmacy_reference from find_medicare_pharmacies, not a guessed branch or bare identifier."
    },
    "pharmacy_search": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "zip": {
          "type": "string",
          "pattern": "^\\d{5}$"
        },
        "q": {
          "type": "string",
          "minLength": 2,
          "maxLength": 100
        },
        "county": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60
        },
        "state": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "include_farther": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "zip"
      ],
      "additionalProperties": false,
      "description": "Optional pharmacy search context, separate from home. Use only a supplied search ZIP or an agreed search near home; include_farther only after agreement."
    },
    "include_partial": {
      "type": "boolean",
      "default": false,
      "description": "True only after agreement to show plans with incomplete or unverified medication matches."
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10,
      "default": 10,
      "description": "Maximum displayed results, from 1 to 10 (default 10)."
    }
  }
}
```

## Example request

Minimal synthetic request after initialization. A missing-input clarification is a valid result; do not invent personal facts to complete it. For content retrieval, replace the illustrative fixture ID with an ID returned by search.

```json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "compare_plan_drug_costs",
    "arguments": {}
  }
}
```

## Connection

POST JSON-RPC to https://tools.thepocketprotector.com/mcp with method `tools/call`, name `compare_plan_drug_costs`, and arguments matching the schema above. Call `tools/list` to verify deployed availability.

## Results and errors

Read both `content` and `structuredContent`. Follow returned clarification or continuation steps. Preserve source attribution, dates, uncertainty and scope. `isError: true` means the lookup did not complete. HTTP 429 requires waiting for `Retry-After`; never repeatedly retry an unavailable lookup.

## Tool annotations

```json
{
  "title": "Compare plan drug costs at a pharmacy",
  "readOnlyHint": true,
  "openWorldHint": true,
  "destructiveHint": false
}
```

Authentication: public, no account or API key required. Public tools perform no enrollment or account writes.
