Documentation
¶
Overview ¶
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Package tools provides the OpenStreetMap MCP tools implementations.
Index ¶
- Constants
- func AnalyzeCommuteTool() mcp.Tool
- func AnalyzeNeighborhoodTool() mcp.Tool
- func ErrorResponse(message string) *mcp.CallToolResult
- func ErrorWithGuidance(err *APIError) *mcp.CallToolResult
- func ExploreAreaTool() mcp.Tool
- func FindChargingStationsTool() mcp.Tool
- func FindNearbyPlacesTool() mcp.Tool
- func FindParkingAreasTool() mcp.Tool
- func FindRouteChargingStationsTool() mcp.Tool
- func FindSchoolsNearbyTool() mcp.Tool
- func GeocodeAddressTool() mcp.Tool
- func GetRouteDirectionsTool() mcp.Tool
- func GetRouteTool() mcp.Tool
- func HandleAnalyzeCommute(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleAnalyzeNeighborhood(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleExploreArea(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleFindChargingStations(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleFindNearbyPlaces(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleFindParkingFacilities(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleFindRouteChargingStations(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleFindSchoolsNearby(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleGeocodeAddress(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleGetRoute(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleGetRouteDirections(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleReverseGeocode(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleSearchCategory(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func HandleSuggestMeetingPoint(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func ParseArray(req mcp.CallToolRequest, paramName string) ([]interface{}, error)
- func ReverseGeocodeTool() mcp.Tool
- func SearchCategoryTool() mcp.Tool
- func SuggestMeetingPointTool() mcp.Tool
- type APIError
- type Address
- type AreaDescription
- type ChargingStation
- type CommuteAnalysis
- type CommuteOption
- type GeocodeAddressInput
- type GeocodeAddressOutput
- type Location
- type NeighborhoodAnalysis
- type NeighborhoodInfo
- type OSRMLeg
- type OSRMManeuver
- type OSRMRoute
- type OSRMRouteResponse
- type OSRMStep
- type OSRMWaypoint
- type ParkingArea
- type Place
- type Registry
- type ReverseGeocodeInput
- type ReverseGeocodeOutput
- type Route
- type RouteChargingStation
- type RouteDirections
- type School
- type Segment
- type ToolDefinition
- type TransportMode
Constants ¶
const ( // Nominatim guidance GuidanceNominatimAddressFormat = "Try using a more standard address format or provide city and country." GuidanceNominatimRateLimit = "Please try again in a few seconds." GuidanceNominatimTimeout = "Check your internet connection and try again, or use different geocoding parameters." GuidanceNominatimGeneral = "Check your address formatting and try again." // Overpass guidance GuidanceOverpassTimeout = "Consider simplifying your query by reducing the search radius or adding more specific filters." GuidanceOverpassRateLimit = "The Overpass API is currently experiencing high load. Please try again in a minute." GuidanceOverpassSyntax = "There's an issue with the query format. Try simplifying your search." GuidanceOverpassMemory = "The query requires too much memory. Try reducing the search area or adding more specific filters." GuidanceOverpassGeneral = "Try a smaller search radius or fewer search criteria." // OSRM guidance GuidanceOSRMRouteNotFound = "No route could be found between the specified points. Try locations with accessible roads." GuidanceOSRMRateLimit = "The routing service is experiencing high load. Please try again in a few seconds." GuidanceOSRMTimeout = "The routing request timed out. Try a shorter route or check your internet connection." GuidanceOSRMGeneral = "Check that your coordinates are accessible by the specified transport mode." // Generic guidance GuidanceGeneral = "Please try again later or modify your request parameters." GuidanceNetworkError = "Check your internet connection and try again." GuidanceDataError = "The data received was incomplete or malformed. Try different search parameters." )
Common error guidance messages
Variables ¶
This section is empty.
Functions ¶
func AnalyzeCommuteTool ¶
AnalyzeCommuteTool returns a tool definition for analyzing commute options
func AnalyzeNeighborhoodTool ¶
AnalyzeNeighborhoodTool returns a tool definition for analyzing neighborhood livability
func ErrorResponse ¶
func ErrorResponse(message string) *mcp.CallToolResult
ErrorResponse is used for consistent error reporting
func ErrorWithGuidance ¶
func ErrorWithGuidance(err *APIError) *mcp.CallToolResult
ErrorWithGuidance returns a properly formatted error response with user guidance.
func ExploreAreaTool ¶
ExploreAreaTool returns a tool definition for exploring an area
func FindChargingStationsTool ¶
FindChargingStationsTool returns a tool definition for finding EV charging stations
func FindNearbyPlacesTool ¶
FindNearbyPlacesTool returns a tool definition for finding nearby places
func FindParkingAreasTool ¶
FindParkingAreasTool returns a tool definition for finding parking facilities
func FindRouteChargingStationsTool ¶
FindRouteChargingStationsTool returns a tool definition for finding charging stations along a route
func FindSchoolsNearbyTool ¶
FindSchoolsNearbyTool returns a tool definition for finding schools near a location
func GeocodeAddressTool ¶
GeocodeAddressTool returns a tool definition for geocoding addresses
func GetRouteDirectionsTool ¶
GetRouteDirectionsTool returns a tool definition for getting route directions
func GetRouteTool ¶
GetRouteTool returns a tool definition for route calculation
func HandleAnalyzeCommute ¶
func HandleAnalyzeCommute(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleAnalyzeCommute implements commute analysis functionality
func HandleAnalyzeNeighborhood ¶
func HandleAnalyzeNeighborhood(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleAnalyzeNeighborhood implements neighborhood livability analysis functionality
func HandleExploreArea ¶
func HandleExploreArea(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleExploreArea implements area exploration functionality
func HandleFindChargingStations ¶
func HandleFindChargingStations(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleFindChargingStations implements finding charging stations
func HandleFindNearbyPlaces ¶
func HandleFindNearbyPlaces(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleFindNearbyPlaces implements finding nearby POIs
func HandleFindParkingFacilities ¶
func HandleFindParkingFacilities(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleFindParkingFacilities implements finding parking facilities functionality
func HandleFindRouteChargingStations ¶
func HandleFindRouteChargingStations(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleFindRouteChargingStations implements finding charging stations along a route
func HandleFindSchoolsNearby ¶
func HandleFindSchoolsNearby(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleFindSchoolsNearby implements finding schools functionality
func HandleGeocodeAddress ¶
func HandleGeocodeAddress(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleGeocodeAddress implements the geocoding functionality
func HandleGetRoute ¶
func HandleGetRoute(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleGetRoute implements route calculation
func HandleGetRouteDirections ¶
func HandleGetRouteDirections(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleGetRouteDirections gets directions between two points
func HandleReverseGeocode ¶
func HandleReverseGeocode(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleReverseGeocode implements the reverse geocoding functionality
func HandleSearchCategory ¶
func HandleSearchCategory(ctx context.Context, rawInput mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleSearchCategory implements category search functionality
func HandleSuggestMeetingPoint ¶
func HandleSuggestMeetingPoint(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
HandleSuggestMeetingPoint suggests meeting points for multiple participants
func ParseArray ¶
func ParseArray(req mcp.CallToolRequest, paramName string) ([]interface{}, error)
ParseArray extracts an array parameter from a CallToolRequest
func ReverseGeocodeTool ¶
ReverseGeocodeTool returns a tool definition for reverse geocoding
func SearchCategoryTool ¶
SearchCategoryTool returns a tool definition for searching places by category
func SuggestMeetingPointTool ¶
SuggestMeetingPointTool returns a tool definition for suggesting meeting points
Types ¶
type APIError ¶
type APIError struct {
Service string // The API service name (e.g., "Nominatim", "Overpass")
StatusCode int // HTTP status code
Message string // Error message
Recoverable bool // Whether the error can be recovered from
Guidance string // Guidance for users on how to recover
}
APIError represents an error that occurred while communicating with an external API service, with information to help users recover.
func NewAPIError ¶
NewAPIError creates a new APIError with appropriate guidance based on status code.
func ValidationError ¶
ValidationError creates an error for invalid coordinate or radius parameters.
type Address ¶
type Address struct {
Street string `json:"street,omitempty"`
HouseNumber string `json:"house_number,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
Formatted string `json:"formatted,omitempty"`
}
Address represents a structured address
type AreaDescription ¶
type AreaDescription struct {
Center Location `json:"center"`
Radius float64 `json:"radius"`
Categories map[string]int `json:"categories"`
PlaceCounts map[string]int `json:"place_counts"`
KeyFeatures []string `json:"key_features"`
TopPlaces []Place `json:"top_places"`
Neighborhood NeighborhoodInfo `json:"neighborhood,omitempty"`
}
AreaDescription represents a description of an area
type ChargingStation ¶
type ChargingStation struct {
ID string `json:"id"`
Name string `json:"name"`
Location Location `json:"location"`
Distance float64 `json:"distance,omitempty"` // in meters
Operator string `json:"operator,omitempty"`
SocketTypes []string `json:"socket_types,omitempty"`
Power string `json:"power,omitempty"` // max power in kW
Access string `json:"access,omitempty"`
Fee bool `json:"fee,omitempty"`
}
ChargingStation represents an EV charging station
type CommuteAnalysis ¶
type CommuteAnalysis struct {
HomeLocation Location `json:"home_location"`
WorkLocation Location `json:"work_location"`
CommuteOptions []CommuteOption `json:"commute_options"`
RecommendedOption string `json:"recommended_option"` // e.g., "car", "transit", "cycling"
Factors []string `json:"factors,omitempty"` // factors considered in recommendation
}
CommuteAnalysis represents the full analysis of commute options
type CommuteOption ¶
type CommuteOption struct {
Mode string `json:"mode"` // car, transit, walking, cycling
Distance float64 `json:"distance"` // in meters
Duration float64 `json:"duration"` // in seconds
Summary string `json:"summary"` // brief description of the route
Instructions []string `json:"instructions,omitempty"` // turn-by-turn directions
CO2Emission float64 `json:"co2_emission,omitempty"` // in kg, if available
CaloriesBurned float64 `json:"calories_burned,omitempty"` // if applicable (walking, cycling)
Cost float64 `json:"cost,omitempty"` // estimated cost in local currency, if available
}
CommuteOption represents a transportation option for commuting
type GeocodeAddressInput ¶
type GeocodeAddressInput struct {
Address string `json:"address"`
}
GeocodeAddressInput defines the input parameters for geocoding an address
type GeocodeAddressOutput ¶
type GeocodeAddressOutput struct {
Place Place `json:"place"`
}
GeocodeAddressOutput defines the output format for geocoded addresses
type NeighborhoodAnalysis ¶
type NeighborhoodAnalysis struct {
Name string `json:"name,omitempty"`
Location Location `json:"location"`
WalkScore int `json:"walk_score"` // 0-100 walkability score
BikeScore int `json:"bike_score"` // 0-100 biking score
TransitScore int `json:"transit_score"` // 0-100 public transit score
EducationScore int `json:"education_score"` // 0-100 education facilities score
ShoppingScore int `json:"shopping_score"` // 0-100 shopping amenities score
DiningScore int `json:"dining_score"` // 0-100 dining options score
RecreationScore int `json:"recreation_score"` // 0-100 recreation options score
SafetyScore int `json:"safety_score"` // 0-100 safety score
HealthcareScore int `json:"healthcare_score"` // 0-100 healthcare facilities score
OverallScore int `json:"overall_score"` // 0-100 overall livability score
PriceIndex int `json:"price_index"` // 0-100 relative price index (higher is more expensive)
Summary string `json:"summary"` // Textual summary of the analysis
KeyAmenities []string `json:"key_amenities"` // List of notable amenities nearby
KeyIssues []string `json:"key_issues"` // List of notable issues or drawbacks
}
NeighborhoodAnalysis represents the analysis of a neighborhood for livability
type NeighborhoodInfo ¶
type NeighborhoodInfo struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
}
NeighborhoodInfo contains information about a neighborhood
type OSRMLeg ¶
type OSRMLeg struct {
Distance float64 `json:"distance"`
Duration float64 `json:"duration"`
Steps []OSRMStep `json:"steps"`
Summary string `json:"summary"`
Weight float64 `json:"weight"`
}
OSRMLeg represents a leg of the OSRM route
type OSRMManeuver ¶
type OSRMManeuver struct {
BearingAfter int `json:"bearing_after"`
BearingBefore int `json:"bearing_before"`
Location []float64 `json:"location"`
Type string `json:"type"`
}
OSRMManeuver represents a maneuver in an OSRM step
type OSRMRoute ¶
type OSRMRoute struct {
Distance float64 `json:"distance"`
Duration float64 `json:"duration"`
Geometry string `json:"geometry"`
Legs []OSRMLeg `json:"legs"`
Weight float64 `json:"weight"`
WeightName string `json:"weight_name"`
}
OSRMRoute represents a single route in the OSRM response
type OSRMRouteResponse ¶
type OSRMRouteResponse struct {
Code string `json:"code"`
Message string `json:"message,omitempty"`
Routes []OSRMRoute `json:"routes,omitempty"`
Waypoints []OSRMWaypoint `json:"waypoints,omitempty"`
}
OSRMRouteResponse represents the response from the OSRM routing service
type OSRMStep ¶
type OSRMStep struct {
Distance float64 `json:"distance"`
Duration float64 `json:"duration"`
Geometry string `json:"geometry"`
Maneuver OSRMManeuver `json:"maneuver"`
Mode string `json:"mode"`
Name string `json:"name"`
Weight float64 `json:"weight"`
}
OSRMStep represents a step in an OSRM leg
type OSRMWaypoint ¶
type OSRMWaypoint struct {
Distance float64 `json:"distance"`
Name string `json:"name"`
Location []float64 `json:"location"`
}
OSRMWaypoint represents a waypoint in the OSRM route
type ParkingArea ¶
type ParkingArea struct {
ID string `json:"id"`
Name string `json:"name"`
Location Location `json:"location"`
Distance float64 `json:"distance,omitempty"` // in meters
Type string `json:"type,omitempty"` // e.g., surface, underground, multi-storey
Access string `json:"access,omitempty"` // e.g., public, private, customers
Capacity int `json:"capacity,omitempty"` // number of parking spaces if available
Fee bool `json:"fee,omitempty"` // whether there's a parking fee
MaxStay string `json:"max_stay,omitempty"` // maximum parking duration if available
Availability string `json:"availability,omitempty"` // if real-time availability is known
Wheelchair bool `json:"wheelchair,omitempty"` // wheelchair accessibility
Operator string `json:"operator,omitempty"` // who operates the facility
}
ParkingArea represents a parking facility
type Place ¶
type Place struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Location Location `json:"location"`
Address Address `json:"address,omitempty"`
Categories []string `json:"categories,omitempty"`
Rating float64 `json:"rating,omitempty"`
Distance float64 `json:"distance,omitempty"` // in meters
}
Place represents a named location with coordinates and optional address
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all MCP tool registrations for the OpenStreetMap service.
func NewRegistry ¶
NewRegistry creates a new MCP tool registry.
func (*Registry) GetToolDefinitions ¶
func (r *Registry) GetToolDefinitions() []ToolDefinition
GetToolDefinitions returns all OpenStreetMap MCP tool definitions.
func (*Registry) RegisterTools ¶
RegisterTools registers all tools with the MCP server.
type ReverseGeocodeInput ¶
type ReverseGeocodeInput struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
ReverseGeocodeInput defines the input parameters for reverse geocoding
type ReverseGeocodeOutput ¶
type ReverseGeocodeOutput struct {
Place Place `json:"place"`
}
ReverseGeocodeOutput defines the output format for reverse geocoded coordinates
type Route ¶
type Route struct {
Distance float64 `json:"distance"` // in meters
Duration float64 `json:"duration"` // in seconds
StartPoint Location `json:"start_point"`
EndPoint Location `json:"end_point"`
Instructions []string `json:"instructions"`
Polyline []Location `json:"polyline,omitempty"`
}
Route represents a path between two locations
type RouteChargingStation ¶
type RouteChargingStation struct {
ChargingStation
DistanceFromStart float64 `json:"distance_from_start"` // in meters
PercentAlongRoute float64 `json:"percent_along_route"` // 0-100
}
RouteChargingStation extends ChargingStation with route-specific information
type RouteDirections ¶
type RouteDirections struct {
Distance float64 `json:"distance"` // Total distance in meters
Duration float64 `json:"duration"` // Total duration in seconds
StartPoint Location `json:"start_point"` // Starting point
EndPoint Location `json:"end_point"` // Ending point
Segments []Segment `json:"segments"` // Route segments
Coordinates [][]float64 `json:"coordinates"` // Route geometry as [lon, lat] pairs
}
RouteDirections represents a calculated route between two points
type School ¶
type School struct {
ID string `json:"id"`
Name string `json:"name"`
Location Location `json:"location"`
Distance float64 `json:"distance,omitempty"` // in meters
Type string `json:"type,omitempty"` // e.g., elementary, secondary, university
Rating float64 `json:"rating,omitempty"` // if available
IsPublic bool `json:"is_public,omitempty"` // true for public schools
Website string `json:"website,omitempty"` // school website if available
PhoneNumber string `json:"phone_number,omitempty"` // contact number if available
}
School represents an educational institution
type Segment ¶
type Segment struct {
Distance float64 `json:"distance"` // Segment distance in meters
Duration float64 `json:"duration"` // Segment duration in seconds
Instruction string `json:"instruction"` // Human-readable instruction
Location Location `json:"location"` // Location of the maneuver
}
Segment represents a segment of a route with directions
type ToolDefinition ¶
type ToolDefinition struct {
Name string
Description string
Tool mcp.Tool
Handler func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error)
}
ToolDefinition represents an OpenStreetMap MCP tool definition.
type TransportMode ¶
type TransportMode string
TransportMode represents different transportation methods
const ( TransportModeCar TransportMode = "car" TransportModeBicycle TransportMode = "bicycle" TransportModeWalking TransportMode = "walking" TransportModeTransit TransportMode = "transit" )