MeMesh API Documentation - v2.8.10
    Preparing search index...

    Class MCPToolInterface

    MCP Tool Interface Class

    Central registry and invocation point for all MCP tools. Agents use this interface to interact with MCP tools in a standardized way.

    Index

    Constructors

    Properties

    filesystem: {
        readFile: (path: string) => Promise<string>;
        writeFile: (opts: { path: string; content: string }) => Promise<void>;
    } = ...

    Filesystem helper methods Provides convenient access to filesystem MCP tool operations

    Type Declaration

    • readFile: (path: string) => Promise<string>

      Read file content

    • writeFile: (opts: { path: string; content: string }) => Promise<void>

      Write file content

      Writes content to a file, creating the file if it doesn't exist or overwriting it if it does.

      // Write JSON data
      await mcpTools.filesystem.writeFile({
      path: 'data/output.json',
      content: JSON.stringify({ results: [...] }, null, 2)
      });

      // Write generated code
      await mcpTools.filesystem.writeFile({
      path: 'generated/schema.ts',
      content: generatedTypeScriptCode
      });

      // Write log file
      await mcpTools.filesystem.writeFile({
      path: 'logs/execution.log',
      content: `Execution completed at ${new Date().toISOString()}`
      });
    memory: {
        createEntities: (opts: CreateEntitiesInput) => Promise<void>;
        searchNodes: (query: string) => Promise<unknown[]>;
    } = ...

    Memory helper methods

    Provides convenient access to memory/knowledge graph MCP tool operations. Enables structured knowledge storage and retrieval for project context, decisions, lessons learned, and system architecture.

    Type Declaration

    • createEntities: (opts: CreateEntitiesInput) => Promise<void>

      Create entities in knowledge graph

      Creates new entities (nodes) in the knowledge graph with associated observations and metadata. Useful for storing project milestones, decisions, lessons learned, and system architecture information.

      // Store lesson learned
      await mcpTools.memory.createEntities({
      entities: [{
      name: 'Authentication Bug Fix 2025-01-01',
      entityType: 'lesson_learned',
      observations: [
      'Root cause: JWT token expiry not properly handled',
      'Fix: Added token refresh mechanism',
      'Prevention: Added integration tests for auth flow'
      ]
      }]
      });

      // Store architecture decision
      await mcpTools.memory.createEntities({
      entities: [{
      name: 'PostgreSQL Database Selection',
      entityType: 'architecture_decision',
      observations: [
      'Chosen PostgreSQL over MongoDB',
      'Reason: Complex relational queries required',
      'Trade-off: More rigid schema but better data integrity'
      ]
      }]
      });
    • searchNodes: (query: string) => Promise<unknown[]>

      Search nodes in knowledge graph

      Searches the knowledge graph for entities matching a query string. Searches across entity names, types, and observation content.

      // Search for API-related entities
      const apiNodes = await mcpTools.memory.searchNodes('API endpoints');
      console.log(`Found ${apiNodes.length} API-related nodes`);

      // Search for recent decisions
      const decisions = await mcpTools.memory.searchNodes('architecture decision');

      // Search for specific component
      const authNodes = await mcpTools.memory.searchNodes('authentication');
      authNodes.forEach(node => {
      console.log(`Entity: ${node.name}, Type: ${node.entityType}`);
      });
    // Store project milestone
    await mcpTools.memory.createEntities({
    entities: [{
    name: 'API Integration v2.2',
    entityType: 'milestone',
    observations: [
    'Completed RESTful API endpoints',
    'Added authentication middleware',
    'Achieved 95% test coverage'
    ]
    }]
    });

    // Search for architecture decisions
    const results = await mcpTools.memory.searchNodes('database schema');
    console.log(`Found ${results.length} related nodes`);
    playwright: {
        navigate: (url: string) => Promise<void>;
        snapshot: () => Promise<unknown>;
        click: (opts: { element: string; ref: string }) => Promise<void>;
        type: (
            opts: { element: string; ref: string; text: string; submit?: boolean },
        ) => Promise<void>;
        waitFor: (opts: { text?: string; time?: number }) => Promise<void>;
        takeScreenshot: (
            opts: { filename?: string; fullPage?: boolean },
        ) => Promise<void>;
        evaluate: (opts: { function: string }) => Promise<unknown>;
        close: () => Promise<void>;
    } = ...

    Playwright helper methods Provides convenient access to Playwright MCP tool operations for browser automation

    Type Declaration

    • navigate: (url: string) => Promise<void>

      Navigate to a URL

    • snapshot: () => Promise<unknown>

      Take an accessibility snapshot of the current page

    • click: (opts: { element: string; ref: string }) => Promise<void>

      Click an element on the page

    • type: (
          opts: { element: string; ref: string; text: string; submit?: boolean },
      ) => Promise<void>

      Type text into an element

    • waitFor: (opts: { text?: string; time?: number }) => Promise<void>

      Wait for a condition

    • takeScreenshot: (opts: { filename?: string; fullPage?: boolean }) => Promise<void>

      Take a screenshot

    • evaluate: (opts: { function: string }) => Promise<unknown>

      Evaluate JavaScript expression on page

    • close: () => Promise<void>

      Close the browser

    Methods

    • Cleanup all active child processes

      ✅ FIX HIGH-1: Kill all spawned processes on shutdown Sends SIGTERM then SIGKILL to ensure processes don't become zombies

      Returns void

    • Parameters

      • dispatcher: ToolDispatcher

      Returns void

    • Bash command execution helper Provides vetted access to shell command execution.

      Parameters

      • opts: {
            command: string;
            timeout?: number;
            confirmed?: boolean;
            confirmationReason?: string;
        }

      Returns Promise<CommandResult>

    • Register an MCP tool

      Parameters

      • toolName: string

        Name of the tool to register

      • metadata: ToolMetadata

        Tool metadata (description, methods)

      Returns boolean

      True if registration successful

    • Check if a tool is registered

      Parameters

      • toolName: string

        Name of the tool to check

      Returns boolean

      True if tool is registered

    • Get list of all registered tools

      Returns string[]

      Array of registered tool names

    • Invoke an MCP tool

      Parameters

      • toolName: string

        Name of the tool to invoke

      • method: string

        Method to call on the tool

      • params: Record<string, unknown>

        Parameters to pass to the tool

      Returns Promise<ToolInvocationResult>

      Promise Result of the invocation

      Error if tool is not registered or method is invalid

    • Invoke a MeMesh tool directly via in-process dispatcher

      Parameters

      • toolName: string

        MCP tool name (e.g., "buddy-do", "memesh-remember")

      • args: Record<string, unknown>

        Tool arguments

      Returns Promise<ToolInvocationResult>

      ToolInvocationResult with MCP CallToolResult payload