Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

get_hostname

Retrieve the hostname of the machine running the Local Utilities MCP Server to identify the system in network operations.

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 implements the core logic of the 'get_hostname' tool. It calls getHostname() to retrieve the system hostname and returns it formatted 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 }] }; }
  • The registerHostnameTool function that registers the 'get_hostname' MCP tool on the server, specifying the tool name, description, and 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 utility function that retrieves the hostname using Node.js 'os' module.
    export function getHostname(): string { return os.hostname(); }
  • src/index.ts:19-19 (registration)
    Invocation of registerHostnameTool during server initialization, effectively registering the tool.
    registerHostnameTool(server);

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