Skip to main content
Glama

get_kpi_groups

Retrieve thematic KPI groups to organize Swedish public sector performance indicators by topic, enabling structured analysis of municipal and regional data.

Instructions

Lista KPI-grupper (tematiska samlingar av nyckeltal) med valfri sökning. Grupper hjälper till att organisera KPIs efter ämne.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSökterm för att filtrera grupper efter titel

Implementation Reference

  • Executes the get_kpi_groups tool: logs call, fetches KPI groups from Kolada API (/kpi_groups) with optional title filter, returns JSON with count and summarized groups (id, title, desc, member count), handles errors.
    handler: async (args: z.infer<typeof getKpiGroupsSchema>): Promise<ToolResult> => { const startTime = Date.now(); const { query } = args; logger.toolCall('get_kpi_groups', { query }); try { const params: Record<string, string> = {}; if (query) params.title = query; const groups = await koladaClient.fetchAllData<KPIGroup>('/kpi_groups', params); logger.toolResult('get_kpi_groups', true, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify( { count: groups.length, groups: groups.map((g) => ({ id: g.id, title: g.title, description: g.description, member_count: g.members?.length || 0, })), }, null, 2 ), }, ], }; } catch (error) { logger.toolResult('get_kpi_groups', false, Date.now() - startTime); throw error; } },
  • Zod input schema: optional 'query' string to filter KPI groups by title.
    const getKpiGroupsSchema = z.object({ query: z.string().optional().describe('Sökterm för att filtrera grupper efter titel'), });
  • Local registration of get_kpi_groups tool within kpiTools object, including description, schema, annotations, and inline handler.
    get_kpi_groups: { description: 'Lista KPI-grupper (tematiska samlingar av nyckeltal) med valfri sökning. Grupper hjälper till att organisera KPIs efter ämne.', inputSchema: getKpiGroupsSchema, annotations: READ_ONLY_ANNOTATIONS, handler: async (args: z.infer<typeof getKpiGroupsSchema>): Promise<ToolResult> => { const startTime = Date.now(); const { query } = args; logger.toolCall('get_kpi_groups', { query }); try { const params: Record<string, string> = {}; if (query) params.title = query; const groups = await koladaClient.fetchAllData<KPIGroup>('/kpi_groups', params); logger.toolResult('get_kpi_groups', true, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify( { count: groups.length, groups: groups.map((g) => ({ id: g.id, title: g.title, description: g.description, member_count: g.members?.length || 0, })), }, null, 2 ), }, ], }; } catch (error) { logger.toolResult('get_kpi_groups', false, Date.now() - startTime); throw error; } }, },
  • Global MCP tool registry: spreads kpiTools (containing get_kpi_groups) into allTools, used for tool listing and execution in server handlers.
    export const allTools = { ...kpiTools, ...municipalityTools, ...ouTools, ...dataTools, ...analysisTools, };

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