Skip to main content
Glama
SergeSerb2

Time & Location MCP Server

by SergeSerb2

get_location

Retrieve your current geographic location using IP geolocation or system settings to provide accurate positioning data.

Instructions

Get your current location based on IP geolocation or system settings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get_location' tool that returns the current location information by calling detectLocation if not already loaded.
    case 'get_location': { // Wait for location if not yet loaded if (!LOCATION) { LOCATION = await detectLocation(); } return { content: [ { type: 'text', text: JSON.stringify(LOCATION, null, 2), }, ], }; }
  • Input schema definition for the 'get_location' tool, which takes no parameters.
    inputSchema: { type: 'object', properties: {}, },
  • server.js:126-133 (registration)
    Registration of the 'get_location' tool in the list of available tools.
    { name: 'get_location', description: 'Get your current location based on IP geolocation or system settings', inputSchema: { type: 'object', properties: {}, }, },
  • Helper function that fetches the user's location via IP geolocation API or falls back to environment variables.
    async function detectLocation() { return new Promise((resolve) => { https.get('https://ipapi.co/json/', (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { try { const locationData = JSON.parse(data); resolve({ city: locationData.city || 'Unknown', province: locationData.region || 'Unknown', country: locationData.country_name || 'Unknown', country_code: locationData.country || 'Unknown', coordinates: { latitude: locationData.latitude || 0, longitude: locationData.longitude || 0 }, timezone: locationData.timezone || detectTimezone(), ip: locationData.ip || 'Unknown' }); } catch (e) { // Fallback to environment variables or defaults resolve({ city: process.env.CITY || 'Unknown', province: process.env.PROVINCE || 'Unknown', country: process.env.COUNTRY || 'Unknown', coordinates: { latitude: parseFloat(process.env.LATITUDE) || 0, longitude: parseFloat(process.env.LONGITUDE) || 0 }, timezone: detectTimezone() }); } }); }).on('error', () => { // Fallback to environment variables or defaults resolve({ city: process.env.CITY || 'Unknown', province: process.env.PROVINCE || 'Unknown', country: process.env.COUNTRY || 'Unknown', coordinates: { latitude: parseFloat(process.env.LATITUDE) || 0, longitude: parseFloat(process.env.LONGITUDE) || 0 }, timezone: detectTimezone() }); }); }); }

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/SergeSerb2/time_mcp'

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