search_trips
Find specific trips in a user's travel history by searching with destination names, themes, or partial trip titles using flexible matching that accommodates approximate spelling.
Instructions
Search through a user's trips by name/title using fuzzy matching to find specific trips. Ideal for finding trips by destination (e.g., 'japan', 'italy'), themes (e.g., 'honeymoon', 'business'), or partial name matches. Supports flexible search terms that don't need to match exactly - the fuzzy matching will find relevant trips even with approximate spelling or partial keywords. Use this as the first step when looking for specific trips by destination, theme, or name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | The Polarsteps username whose trips you want to search through | |
| name_query | Yes | Search term to match against trip names/titles (supports partial matching and fuzzy search) |
Implementation Reference
- src/polarsteps_mcp/tools.py:164-181 (handler)The main handler function that performs fuzzy search on user's trips by name or summary matching the query.def search_trips(polarsteps_client: PolarstepsClient, input: SearchTripsInput): user = _get_user(polarsteps_client, input.username) if user.alltrips is None: return single_text_content( f"No trips found for user with username={input.username}" ) matched_trips = fuzzy_search_items( user.alltrips, input.name_query, field_name="name" ) matched_trips.extend( fuzzy_search_items(user.alltrips, input.name_query, field_name="summary") ) return [ TextContent(type="text", text=trip.model_dump_json(include={"id", "name"}, exclude_none=True)) for trip, _ in matched_trips ]
- src/polarsteps_mcp/tools.py:153-162 (schema)Pydantic model defining the input schema for the search_trips tool: username and name_query.class SearchTripsInput(BaseModel): username: str = Field( ..., description="The Polarsteps username whose trips you want to search through", ) name_query: str = Field( ..., description="Search term to match against trip names/titles (supports partial matching and fuzzy search)", )
- src/polarsteps_mcp/tools.py:232-236 (registration)Tool registration in PolarstepsTool enum: name, description, and schema reference.SEARCH_TRIPS = ( "search_trips", "Search through a user's trips by name/title using fuzzy matching to find specific trips. Ideal for finding trips by destination (e.g., 'japan', 'italy'), themes (e.g., 'honeymoon', 'business'), or partial name matches. Supports flexible search terms that don't need to match exactly - the fuzzy matching will find relevant trips even with approximate spelling or partial keywords. **Use this as the first step when looking for specific trips by destination, theme, or name.**", SearchTripsInput, )
- src/polarsteps_mcp/server.py:68-70 (registration)Dispatch case in MCP server's call_tool handler that invokes the search_trips function.case PolarstepsTool.SEARCH_TRIPS: input = SearchTripsInput(**args) return search_trips(client, input)
- src/polarsteps_mcp/server.py:30-39 (registration)MCP server tool listing function that registers all PolarstepsTool entries, including search_trips.@server.list_tools() async def list_tools() -> list[Tool]: return [ Tool( name=tool.value, description=tool.description, inputSchema=tool.schema, ) for tool in PolarstepsTool ]