get_latest_series
Retrieve the most recent data point for a U.S. labor statistics series from the Bureau of Labor Statistics API.
Instructions
Retrieve the most recent data point for a given BLS series ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| series_id | Yes | BLS series ID, e.g. LAUCN040010000000005 |
Implementation Reference
- src/tools/series.ts:44-61 (handler)Registration and handler definition for get_latest_series tool.
server.tool( "get_latest_series", "Retrieve the most recent data point for a given BLS series ID.", { series_id: z .string() .regex(SERIES_ID_PATTERN, "Series ID must be uppercase with no special characters except _, -, #") .describe("BLS series ID, e.g. LAUCN040010000000005"), }, async ({ series_id }) => { try { const data = await client.getLatestSeries(series_id); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (error) { return wrapError(error); } } ); - src/client.ts:71-81 (handler)Implementation of the getLatestSeries method in the BLS API client.
async getLatestSeries(seriesId: string): Promise<unknown> { try { const response = await this.http.get( `/timeseries/data/${seriesId}`, { params: { latest: true } } ); return response.data; } catch (error) { this.handleError(error); } }