Skip to main content
Glama

local.descriptions

Retrieve detailed descriptions for multiple local businesses or points of interest by providing their unique location identifiers.

Instructions

Brave Local Search AI descriptions: fetch descriptions for up to 20 location ids

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYes

Implementation Reference

  • The handler function for the 'local.descriptions' tool. It constructs a URLSearchParams with the provided location IDs and calls the braveGet helper to fetch AI descriptions from the Brave Local Search API endpoint, returning the JSON stringified response.
    { name: 'local.descriptions', description: 'Brave Local Search AI descriptions: fetch descriptions for up to 20 location ids', inputSchema: idsArraySchema, async handler(args) { const usp = new URLSearchParams(); for (const id of args.ids as string[]) usp.append('ids', id); const data = await braveGet('https://api.search.brave.com/res/v1/local/descriptions', Object.fromEntries(usp.entries())); return { content: [{ type: 'text', text: JSON.stringify(data) }] }; }, },
  • Input schema for the 'local.descriptions' tool (shared with 'local.pois'). Requires an object with an 'ids' array of 1-20 strings representing location IDs.
    const idsArraySchema = { type: 'object', properties: { ids: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 20, }, }, required: ['ids'], additionalProperties: false, } as const;
  • Utility function braveGet used by the handler to make authenticated requests to Brave Search APIs, handling API keys, parameters, headers, and error checking.
    async function braveGet(url: string, params: Record<string, string | number | boolean | undefined>) { const apiKey = process.env.EARCH_MCP_API_KEY || process.env.BRAVE_API_KEY || process.env.BRAVE_SEARCH_API_KEY; if (!apiKey) { throw new Error('Missing API key. Set EARCH_MCP_API_KEY or BRAVE_API_KEY.'); } const headers: Record<string, string> = { Accept: 'application/json', 'Accept-Encoding': 'gzip', 'X-Subscription-Token': apiKey, }; const usp = new URLSearchParams(); for (const [k, v] of Object.entries(params)) { if (v === undefined) continue; usp.set(k, String(v)); } const endpoint = `${url}?${usp.toString()}`; const res = await fetch(endpoint, { headers }); if (!res.ok) { const body = await res.text().catch(() => ''); throw new Error(`Brave API error ${res.status}: ${body}`); } return res.json(); }
  • src/index.ts:143-144 (registration)
    Creation of toolList (for list tools) and toolMap (for dynamic lookup in call tool handler), registering all tools including 'local.descriptions'.
    const toolList = toolDefs.map(({ name, description, inputSchema }) => ({ name, description, inputSchema })); const toolMap = new Map(toolDefs.map((t) => [t.name, t]));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nanameru/search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server