get_ref_data
Retrieve system reference data and lookup information for categories like user management, content operations, and site administration on the Kapiti platform.
Instructions
Get system reference data and lookups
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Reference data category to filter by |
Implementation Reference
- src/index.ts:239-270 (registration)Registration of the 'get_ref_data' MCP tool, including title, description, empty input schema, and inline async handler function that fetches and returns system reference data from the Headlesshost API endpoint `/tools/system/refdata`, handling errors with handleApiError.server.registerTool( "get_ref_data", { title: "Get Reference Data", description: "Get system reference data and lookups for global use. For sections types call the get_staging_site_configuration endpoint.", inputSchema: {}, }, async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get(`/tools/system/refdata`); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );
- src/index.ts:246-269 (handler)Inline handler function for the get_ref_data tool: performs a GET request to `/tools/system/refdata`, stringifies and returns the API response as text content, or error content on failure.async () => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get(`/tools/system/refdata`); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
- src/index.ts:241-244 (schema)Tool metadata including title, description, and empty inputSchema (no parameters required).{ title: "Get Reference Data", description: "Get system reference data and lookups for global use. For sections types call the get_staging_site_configuration endpoint.", inputSchema: {},
- src/index.ts:108-115 (schema)TypeScript interface defining the structure of reference data, likely matching the API response format (category with key-value items).interface RefData { category: string; items: Array<{ key: string; value: string; metadata?: any; }>; }
- src/index.ts:158-166 (helper)Helper function used by the handler to format API errors into user-friendly messages.function handleApiError(error: any): string { if (error.response) { return `API Error ${error.response.status}: ${error.response.data?.message || error.response.statusText}`; } else if (error.request) { return "Network Error: Unable to reach API server"; } else { return `Error: ${error.message}`; } }