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()
          });
        });
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the data sources (IP geolocation or system settings) but doesn't cover critical aspects like accuracy limitations, privacy implications, potential errors, or the response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the return value looks like (e.g., coordinates, city name), accuracy considerations, or error handling. For a tool that provides location data, this omission reduces its usefulness for an AI agent in making informed decisions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately avoids unnecessary details. A baseline score of 4 is applied as per the rules for tools with no parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('your current location'), and it specifies the data sources ('based on IP geolocation or system settings'). However, it doesn't explicitly differentiate from its sibling tool 'get_current_time', which is a different resource type, so it doesn't fully meet the sibling differentiation criterion for a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or any context for its application. It lacks explicit when/when-not instructions or mention of prerequisites, which is essential for effective tool selection by an AI agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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