Skip to main content
Glama

get_municipality

Retrieve detailed information about a specific Swedish municipality using its 4-digit ID code, enabling access to public sector data for analysis and comparison.

Instructions

Hämta detaljerad information om en specifik kommun via dess ID. Kommun-ID är 4-siffriga koder (t.ex. "0180" för Stockholm, "1480" för Göteborg).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
municipality_idYesKommun-ID (4-siffrig kod, t.ex. "0180" för Stockholm)

Implementation Reference

  • The main handler function for the 'get_municipality' tool. It fetches detailed municipality information from the Kolada API using the provided municipality_id, handles not found cases, logs execution, and returns formatted JSON results.
    handler: async (args: z.infer<typeof getMunicipalitySchema>): Promise<ToolResult> => { const startTime = Date.now(); const { municipality_id } = args; logger.toolCall('get_municipality', { municipality_id }); try { const response = await koladaClient.request<Municipality>(`/municipality/${municipality_id}`); if (response.values.length === 0) { logger.toolResult('get_municipality', false, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify({ error: 'NOT_FOUND', message: `Kommun med ID "${municipality_id}" hittades inte`, suggestion: 'Använd search_municipalities för att hitta giltiga kommun-ID:n', }), }, ], isError: true, }; } logger.toolResult('get_municipality', true, Date.now() - startTime); return { content: [ { type: 'text', text: JSON.stringify(response.values[0], null, 2), }, ], }; } catch (error) { logger.toolResult('get_municipality', false, Date.now() - startTime); throw error; } },
  • Zod schema defining the input for the get_municipality tool: requires a municipality_id string.
    const getMunicipalitySchema = z.object({ municipality_id: z.string().describe('Kommun-ID (4-siffrig kod, t.ex. "0180" för Stockholm)'), });
  • The allTools object spreads municipalityTools (containing get_municipality) into the central tool registry used by MCP server handlers for tool listing and execution.
    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