Skip to main content
Glama

local.pois

Fetch detailed information for up to 20 location IDs to enhance local search results with business data and points of interest.

Instructions

Brave Local Search POIs: fetch extra info for up to 20 location ids

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYes

Implementation Reference

  • src/index.ts:101-110 (registration)
    Tool object definition in toolDefs array, including name, description, schema reference, and inline handler; this array populates toolMap used in MCP tools/call handler.
    name: 'local.pois', description: 'Brave Local Search POIs: fetch extra info 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/pois', Object.fromEntries(usp.entries())); return { content: [{ type: 'text', text: JSON.stringify(data) }] }; }, },
  • Executes the tool logic: builds URLSearchParams from ids array, calls braveGet on Brave Local POIs endpoint, returns JSON response as text content.
    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/pois', Object.fromEntries(usp.entries())); return { content: [{ type: 'text', text: JSON.stringify(data) }] }; },
  • Input schema validating an object with 'ids' property: array of 1-20 strings.
    const idsArraySchema = { type: 'object', properties: { ids: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 20, }, }, required: ['ids'], additionalProperties: false, } as const;
  • Helper function for authenticated fetch to Brave Search API endpoints, used by local.pois handler.
    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(); }

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