Pipe library / json-price-drop
json-price-drop
Watch a product JSON document and emit when its price is under a ceiling. DummyJSON is a public demo API.
Price and market
dummyjson.com
CLI
pipes run examples/json-price-drop.pipe.yaml
MCP call
{
"name": "pipe__json-price-drop",
"arguments": {}
}
Pipe file
examples/json-price-drop.pipe.yaml
pipes: 0
name: json-price-drop
version: 0.1.0
description: Watch a product JSON document and emit when its price is under a ceiling. DummyJSON is a public demo API.
permissions:
network: [dummyjson.com]
inputs:
type: object
properties:
product_id:
type: integer
minimum: 1
maximum: 100
default: 1
below:
type: number
exclusiveMinimum: 0
default: 10000
required: [product_id, below]
outputs:
type: object
properties:
text: { type: string }
count: { type: integer }
required: [text, count]
output:
text: "${steps.format.text}"
count: "${steps.format.count}"
steps:
- id: fetch
block: fetch_http
with:
url: "https://dummyjson.com/products/${inputs.product_id}"
max_bytes: 200000
retry: { max: 2, backoff_ms: 500 }
timeout_ms: 15000
- id: parsed
block: parse_json
in: "${steps.fetch}"
- id: shaped
block: map
in: "${steps.parsed}"
with:
number: [price, id]
pick: [id, title, price]
- id: cheap
block: filter
in: "${steps.shaped}"
with:
where: { field: price, op: lt, value: "${inputs.below}" }
- id: changed
block: diff_since_last
in: "${steps.cheap}"
with:
key: [id]
compare: [price]
emit: [added, changed]
first_run: all
- id: format
block: format
in: "${steps.changed}"
with:
header: "Price watch:\n"
item_template: "- ${item.title} ${item.price}"
separator: "\n"
- id: print
block: emit_stdout
in: "${steps.format.text}"
with: { format: text }