Outbound Links
rybbit_get_outbound_linksRetrieve outbound link clicks tracked on your site. Shows which external URLs users click and how often, with filters by date, timezone, and dimensions.
Instructions
Get outbound link clicks tracked on the site. Shows which external URLs users are clicking and how often.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | Site ID (numeric ID or domain identifier) | |
| startDate | No | Start date in ISO format (YYYY-MM-DD) | |
| endDate | No | End date in ISO format (YYYY-MM-DD) | |
| timeZone | No | IANA timezone (e.g., Europe/Prague). Default: UTC | |
| filters | No | Array of filters. Example: [{parameter:'browser',type:'equals',value:['Chrome']},{parameter:'country',type:'equals',value:['US','DE']}] | |
| pastMinutesStart | No | Alternative to dates: minutes ago start (e.g., 60 = last hour) | |
| pastMinutesEnd | No | Alternative to dates: minutes ago end (default 0 = now) | |
| page | No | Page number, 1-indexed (default: 1) | |
| limit | No | Results per page (default: 20-50 depending on endpoint, max 200) |
Implementation Reference
- src/tools/events.ts:159-173 (handler)The async handler function that executes the outbound links tool logic. Builds analytics params from args, calls GET /sites/{siteId}/events/outbound, and returns truncated response.
async (args) => { try { const params = client.buildAnalyticsParams(args); const data = await client.get(`/sites/${args.siteId}/events/outbound`, params); return { content: [{ type: "text" as const, text: truncateResponse(data) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } - src/tools/events.ts:154-157 (schema)Input schema for rybbit_get_outbound_links. Spreads analyticsInputSchema (siteId, startDate, endDate, timeZone, filters, pastMinutesStart, pastMinutesEnd) and paginationSchema (page, limit).
inputSchema: { ...analyticsInputSchema, ...paginationSchema, }, - src/tools/events.ts:147-174 (registration)Registration of the tool via server.registerTool('rybbit_get_outbound_links', ...) with title 'Outbound Links', read-only annotations, and description.
server.registerTool( "rybbit_get_outbound_links", { title: "Outbound Links", annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true, destructiveHint: false }, description: "Get outbound link clicks tracked on the site. Shows which external URLs users are clicking and how often.", inputSchema: { ...analyticsInputSchema, ...paginationSchema, }, }, async (args) => { try { const params = client.buildAnalyticsParams(args); const data = await client.get(`/sites/${args.siteId}/events/outbound`, params); return { content: [{ type: "text" as const, text: truncateResponse(data) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } ); - src/client.ts:114-144 (helper)buildAnalyticsParams helper method on RybbitClient used to convert handler args to API query params (start_date, end_date, filters, pagination, etc.).
buildAnalyticsParams(options: { startDate?: string; endDate?: string; timeZone?: string; filters?: FilterParam[]; pastMinutesStart?: number; pastMinutesEnd?: number; bucket?: string; page?: number; limit?: number; offset?: number; }): QueryParams { const params: QueryParams = {}; if (options.startDate) params.start_date = options.startDate; if (options.endDate) params.end_date = options.endDate; if (options.timeZone) params.time_zone = options.timeZone; if (options.filters && options.filters.length > 0) { params.filters = JSON.stringify(options.filters); } if (options.pastMinutesStart !== undefined) params.past_minutes_start = options.pastMinutesStart; if (options.pastMinutesEnd !== undefined) params.past_minutes_end = options.pastMinutesEnd; if (options.bucket) params.bucket = options.bucket; if (options.page !== undefined) params.page = options.page; if (options.limit !== undefined) params.limit = options.limit; if (options.offset !== undefined) params.offset = options.offset; return params; } - src/client.ts:164-181 (helper)truncateResponse helper used to truncate large API responses to CHARACTER_LIMIT chars.
export function truncateResponse(data: unknown): string { const json = JSON.stringify(data, null, 2); if (json.length <= CHARACTER_LIMIT) return json; if (Array.isArray(data)) { const half = Math.max(1, Math.floor(data.length / 2)); const truncated = data.slice(0, half); const result = { data: truncated, truncated: true, truncation_message: `Response truncated from ${data.length} to ${half} items (exceeded ${CHARACTER_LIMIT} char limit). Use pagination (page/limit) or add filters to reduce results.`, }; return JSON.stringify(result, null, 2); } return json.slice(0, CHARACTER_LIMIT) + `\n\n[Response truncated at ${CHARACTER_LIMIT} characters. Use filters or pagination to reduce data.]`; }