membership-card-pdf
Generate a printable BlastPass membership card as a PDF. Use when an associate or member asks to print, reprint, or replace a BlastPass membership card. The skill takes the member details returned by the Membership MCP (get_membership) and generates and runs a short Python (reportlab) snippet that renders a CR80-sized membership card to a real PDF file. It only renders the card from already-retrieved values — it never looks anything up or invents data.
- License 许可
- MIT
- 最近更新
- 2026-11-04
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- membership-card-pdf
- description
- Generate a printable BlastPass membership card as a PDF. Use when an associate or member asks to print, reprint, or replace a BlastPass membership card. The skill takes the member details returned by the Membership MCP (get_membership) and generates and runs a short Python (reportlab) snippet that renders a CR80-sized membership card to a real PDF file. It only renders the card from already-retrieved values — it never looks anything up or invents data.
02 资源文件 1
- 脚本card_pdf.py4.1 KB
03 SKILL.md 正文
BlastPass Membership Card PDF Generator
This skill produces a printable BlastPass membership card — the simplest
file-generation flow in the demo. You take the member record you already pulled
from the Membership MCP (get_membership), then generate and run a short
Python snippet that renders a styled card to a PDF using reportlab.
Never invent a member, tier, or serial number — every value on the card comes from
the get_membership result. This skill only draws the card; it does not decide
anything.
When to use
Use this skill when the associate asks to print / reprint / replace a BlastPass
membership card for a known member. The only prerequisite is a single
get_membership(customer_id) call on the Membership MCP. There is no policy lookup,
no calculation, and no other agent involved — that is what makes this the
entry-level scenario.
Inputs (all from the Membership MCP get_membership result)
| Card field | Source field |
|---|---|
member_name |
member_name |
member_id |
customer_id |
tier |
tier |
tier_code |
tier_code (plus | extra | mega) — drives the accent color & perks |
console_serial |
console_serial |
member_since |
activation_date |
valid_through |
term_end_date |
status |
status |
The tier_code selects the card's accent color, header badge, and the perks line
printed beneath the card:
plus→ blue, "PLUS", 5% off + 10 BlastPoints/$1extra→ purple, "PLUS EXTRA", 10% off + 20% BlastPoints bonusmega→ orange, "MEGA!!!", 15% off + 50% BlastPoints + day-one exclusives
Workflow
1. Pull the member record
Call get_membership with the mega-blast-customer-id (e.g. MEGA-BLAST-2048).
Map its fields into the card dict below. Do not add fields the MCP didn't
return.
2. Generate and run this Python to render the PDF
Fill the card dict with the confirmed values and run the snippet. It writes
blastpass_card.pdf to the working directory; report that path back to the
associate.
from reportlab.lib.pagesizes import LETTER
from reportlab.lib.units import inch
from reportlab.lib import colors
from reportlab.pdfgen import canvas
# --- confirmed values (filled from the Membership MCP get_membership call) ---
card = {
"member_name": "Sam Sparkle",
"member_id": "MEGA-BLAST-2048",
"tier": "BlastPass Plus Extra MEGA!!!",
"tier_code": "mega", # plus | extra | mega
"console_serial": "OMEGA-9B1C-2048",
"member_since": "2026-05-30", # activation_date
"valid_through": "2027-05-30", # term_end_date
"status": "active",
}
# Tier styling: accent color, a short badge for the header, and the perks blurb.
TIERS = {
"plus": ("#3aa0ff", "PLUS",
"Free 2-day shipping | 5% off accessories | 10 BlastPoints / $1"),
"extra": ("#9b51e0", "PLUS EXTRA",
"Free next-day shipping | 10% off accessories | +20% BlastPoints bonus"),
"mega": ("#ff7a18", "MEGA!!!",
"Same-day delivery | 15% off everything | +50% BlastPoints | Day-one exclusives"),
}
accent_hex, tier_badge, perks = TIERS.get(card["tier_code"], TIERS["plus"])
accent = colors.HexColor(accent_hex)
ink = colors.HexColor("#1b1030")
# Card geometry: a standard CR80 card (3.375 x 2.125 in) centered on the page.
PAGE_W, PAGE_H = LETTER
CARD_W, CARD_H = 3.375 * inch, 2.125 * inch
x0 = (PAGE_W - CARD_W) / 2
y0 = (PAGE_H - CARD_H) / 2
c = canvas.Canvas("blastpass_card.pdf", pagesize=LETTER)
# Cut guide
c.setStrokeColor(colors.HexColor("#cccccc"))
c.setDash(2, 2)
c.rect(x0 - 6, y0 - 6, CARD_W + 12, CARD_H + 12)
c.setDash()
# Card body
c.setFillColor(ink)
c.roundRect(x0, y0, CARD_W, CARD_H, 10, stroke=0, fill=1)
# Accent header band
c.setFillColor(accent)
c.roundRect(x0, y0 + CARD_H - 0.55 * inch, CARD_W, 0.55 * inch, 10, stroke=0, fill=1)
c.rect(x0, y0 + CARD_H - 0.55 * inch, CARD_W, 0.18 * inch, stroke=0, fill=1) # square the bottom of the band
# Brand + tier badge
c.setFillColor(colors.white)
c.setFont("Helvetica-Bold", 14)
c.drawString(x0 + 0.22 * inch, y0 + CARD_H - 0.37 * inch, "BlastBox Omega")
# Tier badge pill on the right of the header band
c.setFont("Helvetica-Bold", 8)
badge_w = c.stringWidth(tier_badge, "Helvetica-Bold", 8) + 0.18 * inch
bx_badge = x0 + CARD_W - 0.22 * inch - badge_w
c.setFillColor(colors.Color(1, 1, 1, alpha=0.22))
c.roundRect(bx_badge, y0 + CARD_H - 0.42 * inch, badge_w, 0.20 * inch, 4, stroke=0, fill=1)
c.setFillColor(colors.white)
c.drawCentredString(bx_badge + badge_w / 2, y0 + CARD_H - 0.36 * inch, tier_badge)
# Member name
c.setFillColor(colors.white)
c.setFont("Helvetica-Bold", 13)
c.drawString(x0 + 0.22 * inch, y0 + CARD_H - 0.85 * inch, card["member_name"])
# Member id (mono, spaced)
c.setFillColor(accent)
c.setFont("Courier-Bold", 12)
c.drawString(x0 + 0.22 * inch, y0 + CARD_H - 1.08 * inch, card["member_id"])
# Detail rows
details = [
("MEMBER SINCE", card["member_since"]),
("VALID THROUGH", card["valid_through"]),
("CONSOLE S/N", card["console_serial"]),
]
dy = y0 + CARD_H - 1.30 * inch
for label, val in details:
c.setFillColor(colors.HexColor("#9d90bd"))
c.setFont("Helvetica", 6)
c.drawString(x0 + 0.22 * inch, dy, label)
c.setFillColor(colors.white)
c.setFont("Helvetica-Bold", 8)
c.drawString(x0 + 1.05 * inch, dy, str(val))
dy -= 0.17 * inch
# Faux barcode strip (deterministic from the member id)
bx = x0 + 0.22 * inch
by = y0 + 0.13 * inch
c.setFillColor(colors.white)
import hashlib
seed = int(hashlib.md5(card["member_id"].encode()).hexdigest(), 16)
w = 0.0
i = 0
while w < CARD_W - 0.44 * inch:
bar = 0.012 * inch + ((seed >> (i % 32)) & 0x3) * 0.006 * inch
if i % 2 == 0:
c.rect(bx + w, by, bar, 0.13 * inch, stroke=0, fill=1)
w += bar
i += 1
# Perks footer (printed under the card, not on it)
c.setFillColor(colors.HexColor("#555555"))
c.setFont("Helvetica-Oblique", 8)
c.drawCentredString(PAGE_W / 2, y0 - 0.45 * inch, perks)
c.setFont("Helvetica", 7)
c.drawCentredString(PAGE_W / 2, y0 - 0.62 * inch,
"Present this card in-store or scan at checkout. Lost cards can be reprinted at any BlastBox desk.")
c.showPage()
c.save()
print("WROTE blastpass_card.pdf")
3. Hand back the file
Tell the associate the card was generated (blastpass_card.pdf) and read back the
member name, tier, and member ID so they can confirm it before handing it over.
Notes
- The reference renderer lives next to this file as
card_pdf.pyand is validated against the four mock members in the Membership MCP. - The barcode is decorative (deterministic from the member ID) — it is not a real scannable symbology.
- All data is mock; the card is for demo purposes only.
04 同仓库更多 Skills
slip-pdf-generator
Generate a printable BlastBox return / RMA / exchange slip as a PDF for the associate to hand to the customer. Use at the end of a return, warranty swap, membership cancellation, or upgrade once all amounts are final. The skill runs a bundled Python script that renders the confirmed slip values into a real PDF file.
points-reconciliation
Reconcile a customer's BlastPoints loyalty balance after a complex visit (purchases, returns, promo multipliers, expiry) and convert the net balance to store credit. Use when an associate asks about a member's points, or after a return that should claw back previously earned points. The skill runs a bundled Python script that applies the base earn rate, promo multipliers, tier bonus, clawbacks, and expiry, then prints a points ledger and the redeemable store-credit value.
prorated-refund-calculator
Calculate the exact prorated refund when a customer cancels a BlastPass membership, and the net settlement when a defective unit is traded up to a pricier model. Use after the Store Policy Agent confirms the refund rule and the Membership MCP has returned the membership details. The skill runs a bundled Python script so the arithmetic is exact.
membership-card-png
Generate a digital BlastPass membership card as a PNG image by running the bundled card_png.py script. Use when a member self-serves a lost/stolen/damaged card replacement, or any time a card needs to be shown on screen (vs. printed). The skill takes the member details returned by the Membership MCP (get_membership) plus the new_card_serial returned by reissue_card and passes them as command-line flags to a bundled Python (matplotlib) script that renders a CR80-sized membership card to a real PNG. It only renders the card from already-retrieved values — it never looks anything up or invents data.
membership-card-png
Generate a digital BlastPass membership card as a PNG image by running the bundled card_png.py script. Use when a member self-serves a lost/stolen/damaged card replacement, or any time a card needs to be shown on screen (vs. printed). The skill takes the member details returned by the Membership MCP (get_membership) plus the new_card_serial returned by reissue_card and passes them as command-line flags to a bundled Python (matplotlib) script that renders a CR80-sized membership card to a real PNG. It only renders the card from already-retrieved values — it never looks anything up or invents data.
slip-pdf-generator
Generate a printable BlastBox return / RMA / exchange slip as a PDF for the associate to hand to the customer. Use at the end of a return, warranty swap, membership cancellation, or upgrade once all amounts are final. The skill runs a bundled Python script that renders the confirmed slip values into a real PDF file.