Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

get_hostname

Retrieve the hostname of the machine running the MCP server to identify the system or verify server details using the Local Utilities MCP Server interface.

Instructions

Returns the hostname of the machine running the MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The anonymous async handler function that executes the get_hostname tool logic. It calls the getHostname helper and formats the result as MCP text content.
    async () => { // Note: Error handling is simplified; the MCP SDK handles basic errors. // More complex tools might still need try/catch. const hostname = getHostname(); return { content: [{ type: "text", // Return plain text for simple values text: hostname }] }; }
  • Registers the get_hostname tool on the MCP server, including the name, description, and inline handler function.
    export function registerHostnameTool(server: McpServer): void { server.tool( "get_hostname", "Returns the hostname of the machine running the MCP server.", async () => { // Note: Error handling is simplified; the MCP SDK handles basic errors. // More complex tools might still need try/catch. const hostname = getHostname(); return { content: [{ type: "text", // Return plain text for simple values text: hostname }] }; } ); }
  • Helper function that retrieves and returns the system hostname using Node.js os.hostname().
    export function getHostname(): string { return os.hostname(); }
  • src/index.ts:19-19 (registration)
    Top-level registration call that adds the hostname tool to the main MCP server instance.
    registerHostnameTool(server);

Other Tools

Related 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/arjshiv/localutils-mcp-server'

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