SkilVaultSign inStart free

Catalogue / poi-description-retriever

poi-description-retriever

Older skill: source not recordedSignedTurns point-of-interest identifiers from an earlier search into machine-written markdown place write-ups by calling a search provider's local descriptions endpoint, at most twenty identifiers per request. Covers collecting the identifiers from a locations-filtered web search or a local place search,…
---
name: poi-description-retriever
description: >
  Turns point-of-interest identifiers from an earlier search into machine-written markdown place write-ups by calling a search provider's local descriptions endpoint, at most twenty identifiers per request. Covers collecting the identifiers from a locations-filtered web search or a local place search, percent-encoding them, chunking oversized lists, pairing reply entries to requests by identifier rather than by position, and reporting places that came back empty. Every outbound call and every retry waits for explicit user approval, and the API key stays in a user-set environment variable that the agent references by name but never reads. Use when identifiers from a prior search are already in hand and the user wants narrative overviews of businesses or landmarks to enrich local results. Not for running fresh local searches on their own, for structured facts such as hours or ratings, or for composing descriptions without a prior search step.
allowed-tools: Bash
---

POI Description Retriever

Turn identifiers for points of interest into readable markdown write-ups. The work always runs in two phases: pull the identifiers out of a search that already happened, then hand them to the provider's descriptions endpoint, which answers with model-written overviews of roughly two hundred to four hundred words per place. The endpoint accepts identifiers and nothing else — you cannot query it by name or address — and the identifiers fade after roughly eight hours, so plan around a recent search.

The key stays out of your hands

Every call must present a subscription key in the X-Subscription-Token header. That key belongs to the user and to their environment, never to you.

  • Before you begin, ask the user to export the key under a variable name such as BRAVE_SEARCH_API_KEY in the shell that will run your commands; their shell profile is the right permanent home. Keys are issued through the provider's dashboard and require a subscription that includes search.
  • Write the variable's *name* into the header and nothing else. The shell substitutes the value only as the request executes, so the key travels straight to the API host and never reaches your screen, the transcript, or any saved file.
  • If authentication fails, say so and stop. Do not hunt for the key in files, configuration, or password stores, and do not invite the user to paste it into the conversation.
  • The key's value leaves the machine for the API host and for nowhere else.

Nothing is sent without a yes

Both phases spend the user's paid quota at an outside service. For each batch, lay out the plan — which endpoint, the query or how many identifiers, and how many calls it takes — then wait for a clear approval. One approval covers exactly the batch you described; if the scope grows, or a resend is wanted, ask again. Treat silence as refusal.

Phase one: gather identifiers

The descriptions endpoint only recognizes identifiers that the same provider's search produced. Get them one of two ways:

  1. A web search with the locations result filter, reading each value from the id field inside locations.results:
curl -s --compressed "https://api.search.brave.com/res/v1/web/search?q=independent+bookstores+porto&result_filter=locations" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
  1. The provider's local place search, whose results carry the identifiers directly.

As you collect them, store each identifier beside the place name it arrived with — you need that pairing later to say which places went unanswered. The identifiers are opaque strings that cannot be typed from memory; the ones printed in this skill are stand-ins, so always use values returned by a live search. If your identifiers are several hours old, assume they may have lapsed and budget for a re-search.

Phase two: request the write-ups

GET https://api.search.brave.com/res/v1/local/descriptions

| Parameter | Type | Required | Notes | |---|---|---|---| | ids | repeated string | yes | 1 to 20 per call; repeat the key once per identifier |

Each identifier ends in a character that would otherwise terminate the query string, so either percent-encode that trailing character or let the tool encode the whole value for you:

curl -s --compressed -G "https://api.search.brave.com/res/v1/local/descriptions" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  --data-urlencode "ids=loc8NBKQXW2REJ4CFP7YTZLMBA3GV6HDS1QAAAAAA=" \
  --data-urlencode "ids=loc2XEFZTVK9MB3RAQ8WYCJND46SI0OPG7TAAAAAA="

Twenty identifiers is the ceiling per call, so longer lists become several calls: thirty-three identifiers go out as one call of twenty and one of thirteen, and both calls belong to the single approved plan you described.

Reading the reply

| Field | What it holds | |---|---| | type | Fixed value local_descriptions | | results | Array of entries; an entry is either an object or a bare null | | entry type | Fixed value local_description | | entry id | The identifier this entry answers | | entry description | The markdown write-up, or null when the provider has none |

Example shape:

{
  "type": "local_descriptions",
  "results": [
    {
      "type": "local_description",
      "id": "loc8NBKQXW2REJ4CFP7YTZLMBA3GV6HDS1QAAAAAA=",
      "description": "### Overview\nA two-room shop near the Ribeira stocking **restored mid-century editions** and hand-bound travel journals..."
    },
    null
  ]
}

Matching entries to places

Match strictly by identifier and treat the array's ordering as meaningless — nothing in the API promises that an entry's position reflects your request order.

  1. Link each object entry to a requested identifier by comparing its id exactly.
  2. A bare null carries no id at all, so you cannot know which place it stands for. Leave it unassigned and say nothing about which place it might concern.
  3. A requested identifier that never appears in the reply, or whose entry holds a null description, is reported plainly as having no description available.

Worked example: you sent identifiers for Alma Miradouro Café, Gaivotas Bookbinding, Trem Azul Records, and Cidade Verde Kiosk. The reply holds an object for Alma Miradouro Café with text, an object for Trem Azul Records whose description is null, and one bare null. Report the café's write-up, state that the record shop is confirmed to have none, and say that nothing came back for Gaivotas Bookbinding and Cidade Verde Kiosk — but do not pin the bare null on either of them, because nothing in the reply licenses that guess.

When a call misbehaves

The provider documents no guaranteed error payloads, so treat status codes as leads for a conversation with the user, not verdicts. Whatever the cause, you never resend on your own initiative — every retry, including retries of transient failures, needs a fresh explicit approval.

| What you see | Likely reading | Your move | |---|---|---| | 401 or 403 | Key missing, wrong, or on a plan without search | Stop and tell the user the stored credential needs attention; resending changes nothing | | Errors naming invalid or unknown identifiers, mostly ones gathered hours earlier | The roughly eight-hour lifetime probably ran out | With approval, redo phase one for fresh identifiers, then ask again before the descriptions call | | 429 | Pace or quota limit | Back off and continue only if the user says so | | 5xx or a timeout | Passing trouble on the server side | Wait a moment, then ask whether to resend |

One pattern helps separate the cases: credential trouble strikes every identifier in every batch, while staleness touches only the aged set. If some batches land cleanly and only the older identifiers error out, suspect age rather than authentication.

Handing descriptions to the user

  • The text arrives as markdown — ### headings, bullet lists, bold and italic emphasis. Quote or embed it exactly as received.
  • Attribute it to the search provider and describe it as model-generated text built from web content, not as the business's own statement. When the user leans on specifics inside a write-up, such as prices, history, or ownership, flag them as unverified and point toward a primary source.
  • For places that came back empty, say so directly. If the earlier search handed you structured facts about them, offer those instead — but never compose substitute prose and pass it off as the provider's.

Lines you do not cross

  • Never guess, truncate, or hand-type an identifier; invented values return errors or descriptions for the wrong place.
  • Never pack more than twenty identifiers into one call.
  • Never decide which place a bare null answers.
  • Never send or resend a request the user has not explicitly approved in the current scope.
  • Never display, copy, or store the key's value anywhere except the auth header bound for the API host.

This skill does not cover the local place search, POI details, or web search endpoints beyond their role in supplying identifiers, and it asserts no error-response formats the provider has not documented.