Skip to main content
Glama

get_kpi_group

Retrieve detailed information about a specific KPI group including all constituent key performance indicators for Swedish municipalities and regions.

Instructions

Hämta detaljerad information om en specifik KPI-grupp inklusive alla ingående nyckeltal. Användbar för att utforska relaterade KPIs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesKPI-grupp ID

Implementation Reference

  • The async handler function that implements the core logic of the get_kpi_group tool: fetches the specific KPI group by ID from the Kolada API, handles errors, and returns the group details as JSON.
    handler: async (args: z.infer<typeof getKpiGroupSchema>): Promise<ToolResult> => { const startTime = Date.now(); const { group_id } = args; logger.toolCall('get_kpi_group', { group_id }); try { const response = await koladaClient.request<KPIGroup>(`/kpi_groups/${group_id}`); if (response.values.length === 0) { const error = ERROR_MESSAGES.GROUP_NOT_FOUND(group_id, 'KPI'); throw createMcpError(KoladaErrorType.NOT_FOUND, error.message, { suggestion: error.suggestion, }); } logger.toolResult('get_kpi_group', true, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify(response.values[0], null, 2), }, ], }; } catch (error) { logger.toolResult('get_kpi_group', false, Date.now() - startTime); handleApiError(error, `get_kpi_group(${group_id})`); }
  • Zod input schema for the get_kpi_group tool, requiring a single 'group_id' string parameter.
    const getKpiGroupSchema = z.object({ group_id: z.string().describe('KPI-grupp ID'), });
  • Tool registration object within the exported kpiTools, defining description, input schema, annotations, and handler reference for get_kpi_group.
    get_kpi_group: { description: 'Hämta detaljerad information om en specifik KPI-grupp inklusive alla ingående nyckeltal. Användbar för att utforska relaterade KPIs.', inputSchema: getKpiGroupSchema, annotations: READ_ONLY_ANNOTATIONS, handler: async (args: z.infer<typeof getKpiGroupSchema>): Promise<ToolResult> => { const startTime = Date.now(); const { group_id } = args; logger.toolCall('get_kpi_group', { group_id }); try { const response = await koladaClient.request<KPIGroup>(`/kpi_groups/${group_id}`); if (response.values.length === 0) { const error = ERROR_MESSAGES.GROUP_NOT_FOUND(group_id, 'KPI'); throw createMcpError(KoladaErrorType.NOT_FOUND, error.message, { suggestion: error.suggestion, }); } logger.toolResult('get_kpi_group', true, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify(response.values[0], null, 2), }, ], }; } catch (error) { logger.toolResult('get_kpi_group', false, Date.now() - startTime); handleApiError(error, `get_kpi_group(${group_id})`); } }, },

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/isakskogstad/Kolada-MCP'

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