Skip to main content
Glama

geocode

Convert Swiss addresses or place names to precise coordinates using swisstopo data for location-based applications and mapping.

Instructions

Convert a Swiss address or place name to coordinates (swisstopo)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesSwiss address or place name

Implementation Reference

  • Handler function for the "geocode" tool (and search_places), which fetches data from the swisstopo API.
    export async function handleGeodata(name: string, args: Record<string, unknown>): Promise<string> {
      switch (name) {
        case "geocode":
        case "search_places": {
          const url = buildUrl(`${BASE}/rest/services/api/SearchServer`, {
            searchText: args.address as string ?? args.query as string,
            type: args.type as string ?? "locations",
            sr: 4326,
            limit: 10,
          });
          const data = await fetchJSON<SearchResponse>(url);
          return JSON.stringify({
            count: data.results.length,
            results: data.results.map(slimSearchResult),
          });
        }
  • Tool definition and input schema for the "geocode" tool.
    export const geodataTools = [
      {
        name: "geocode",
        description: "Convert a Swiss address or place name to coordinates (swisstopo)",
        inputSchema: {
          type: "object",
          required: ["address"],
          properties: {
            address: { type: "string", description: "Swiss address or place name" },
          },
        },
      },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/vikramgorla/mcp-swiss'

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