Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

think

Record a thought by providing the content as a string. This tool captures and stores your ideas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYesThe thought content to record

Implementation Reference

  • The actual handler for the 'think' tool - records a thought into internal state and returns a success message.
    async ({ thought }) => {
      thoughts.push({
        timestamp: new Date().toISOString(),
        content: thought
      });
      return {
        content: [{
          type: "text",
          text: "Thought recorded successfully"
        }]
      };
    }
  • The 'think' tool's schema registration with Zod validation - requires a non-empty 'thought' string parameter.
    server.tool(
      "think",
      { thought: z.string().min(1, "Thought cannot be empty").describe("The thought content to record") },
  • The registerThinkTool function that registers the 'think' tool (plus get_thoughts, clear_thoughts, get_thought_stats) on the MCP server.
    export function registerThinkTool(server: McpServer) {
      // Use closure state, but keep the class exported for the old test
      let thoughts: Thought[] = [];
    
      // Register think command
      server.tool(
        "think",
        { thought: z.string().min(1, "Thought cannot be empty").describe("The thought content to record") },
        async ({ thought }) => {
          thoughts.push({
            timestamp: new Date().toISOString(),
            content: thought
          });
          return {
            content: [{
              type: "text",
              text: "Thought recorded successfully"
            }]
          };
        }
      );
    
      // Register get_thoughts command
      server.tool(
        "get_thoughts",
        "Retrieve all recorded thoughts",
        async () => {
          const currentThoughts = [...thoughts];
          return {
            content: [{
              type: "text",
              text: JSON.stringify(currentThoughts, null, 2)
            }]
          };
        }
      );
    
      // Register clear_thoughts command
      server.tool(
        "clear_thoughts",
        "Clear all recorded thoughts",
        async () => {
          const count = thoughts.length;
          thoughts = []; // Reset the array
          return {
            content: [{
              type: "text",
              text: `Cleared ${count} recorded thoughts.`
            }]
          };
        }
      );
    
      // Register get_thought_stats command
      server.tool(
        "get_thought_stats",
        "Get statistics about recorded thoughts",
        async () => {
          const totalThoughts = thoughts.length;
          let statsData; // Renamed to avoid conflict with exported interface
    
          if (totalThoughts === 0) {
            statsData = {
              totalThoughts: 0,
              averageLength: 0,
              oldestThought: null,
              newestThought: null
            };
          } else {
            const averageLength = thoughts.reduce((acc, thought) =>
              acc + thought.content.length, 0) / totalThoughts;
            statsData = {
              totalThoughts,
              averageLength: parseFloat(averageLength.toFixed(2)),
              oldestThought: thoughts[0].timestamp,
              newestThought: thoughts[thoughts.length - 1].timestamp
            };
          }
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(statsData, null, 2)
            }]
          };
        }
      );
  • src/index.ts:10-25 (registration)
    Import and invocation of registerThinkTool in the main entry point, wiring the tool into the server.
    import { registerThinkTool } from "./mcp/think.js";
    
    // Create an MCP server
    const server = new McpServer({
      name: "Local Utilities MCP Server",
      version: "1.0.0"
    });
    
    // Register all utilities
    registerHostnameTool(server);
    registerPublicIpTool(server);
    registerDirectoryTool(server);
    registerNodeVersionTool(server);
    registerPortCheckerTool(server);
    registerTimeTool(server);
    registerThinkTool(server);
  • ThinkToolInternalLogic class with helper methods (addThought, getAllThoughts, clearThoughts, getThoughtStats) for managing thoughts internally.
    export class ThinkToolInternalLogic {
      thoughts: Thought[] = []; // Make public for test access if needed, or add methods
    
      addThought(content: string): void {
        this.thoughts.push({
          timestamp: new Date().toISOString(),
          content
        });
      }
    
      getAllThoughts(): Thought[] {
        return [...this.thoughts];
      }
    
      clearThoughts(): void {
        this.thoughts = [];
      }
    
      getThoughtStats(): ThoughtStats {
        const totalThoughts = this.thoughts.length;
        
        if (totalThoughts === 0) {
          return {
            totalThoughts: 0,
            averageLength: 0,
            oldestThought: null,
            newestThought: null
          };
        }
    
        const averageLength = this.thoughts.reduce((acc, thought) => 
          acc + thought.content.length, 0) / totalThoughts;
    
        return {
          totalThoughts,
          averageLength: parseFloat(averageLength.toFixed(2)), // Keep formatted
          oldestThought: this.thoughts[0].timestamp,
          newestThought: this.thoughts[this.thoughts.length - 1].timestamp
        };
      }
    }
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

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