Skip to main content
Glama

resolve_path

Analyze file system paths to determine correct MCP parameters and suggest usage examples for Houtini-lm server integration.

Instructions

Analyze a file system path and suggest correct MCP parameters

WORKFLOW: System diagnostics and function discovery TIP: Start with health_check, use list_functions to explore capabilities SAVES: Claude context for strategic decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile system path to analyze (file or directory)
suggestionsNoInclude parameter suggestions and usage examples

Implementation Reference

  • Execute method of PathResolverPlugin implementing the core logic of resolve_path tool, including security wrapper, path analysis via helper, and response formatting with suggestions.
    async execute(params: any, llmClient: any) {
      return await withSecurity(this, params, llmClient, async (secureParams) => {
        try {
          const pathAnalysis = await analyzePathForMCP(secureParams.path);
          
          const result: any = {
            path: secureParams.path,
            analysis: pathAnalysis,
            timestamp: new Date().toISOString()
          };
    
          // Add usage suggestions if requested
          if (secureParams.suggestions !== false) {
            result.suggestions = {
              recommendedParameter: pathAnalysis.suggestedParameter,
              exampleUsage: pathAnalysis.type === 'directory' 
                ? `houtini-lm:count_files projectPath="${secureParams.path}"`
                : `houtini-lm:analyze_single_file filePath="${secureParams.path}"`,
              alternativeUsage: pathAnalysis.type === 'directory'
                ? `houtini-lm:security_audit projectPath="${secureParams.path}"`
                : `houtini-lm:generate_unit_tests filePath="${secureParams.path}"`
            };
          }
    
          return {
            success: true,
            timestamp: new Date().toISOString(),
            modelUsed: 'system-utility',
            executionTimeMs: 0,
            data: {
              content: result,
              metadata: {
                functionName: 'resolve_path',
                parsedAt: new Date().toISOString(),
                responseLength: JSON.stringify(result).length
              }
            }
          };
          
        } catch (error: any) {
          return {
            success: false,
            timestamp: new Date().toISOString(),
            modelUsed: 'system-utility',
            executionTimeMs: 0,
            error: {
              code: 'PATH_RESOLUTION_ERROR',
              message: error.message || 'Failed to analyze path',
              details: { originalError: error.message }
            }
          };
        }
      });
    }
  • Input schema definition for the resolve_path tool parameters.
    parameters = {
      path: {
        type: 'string' as const,
        description: 'File system path to analyze (file or directory)',
        required: true
      },
      suggestions: {
        type: 'boolean' as const,
        description: 'Include parameter suggestions and usage examples',
        default: true,
        required: false
      }
    };
  • src/index.ts:156-172 (registration)
    Dynamic plugin loading and registration in loadSystemPlugin method, specifically handling PathResolverPlugin instantiation and registration to pluginLoader.
    private async loadSystemPlugin(filePath: string): Promise<void> {
      try {
        // Use ES module dynamic import with proper URL
        const fileUrl = pathToFileURL(filePath).href;
        const module = await import(fileUrl);
        const PluginClass = module.default || module.HealthCheckPlugin || module.PathResolverPlugin || Object.values(module)[0];
        
        if (PluginClass && typeof PluginClass === 'function') {
          const plugin = new PluginClass();
          this.pluginLoader.registerPlugin(plugin);
          // Removed console.log to avoid JSON-RPC interference
        }
      } catch (error) {
        // Silent error handling to avoid JSON-RPC interference
        // console.error(`[Plugin Server] Error loading system plugin ${filePath}:`, error);
      }
    }
  • Core helper function analyzePathForMCP that performs filesystem stat on the path and returns analysis including type, suggestions, and hints.
    export async function analyzePathForMCP(path: string) {
      try {
        const stats = await stat(path);
        
        const result: any = {
          exists: true,
          type: stats.isDirectory() ? 'directory' : 'file',
          suggestedParameter: stats.isDirectory() ? 'projectPath' : 'filePath',
          size: stats.size,
          canRead: true,
          lastModified: stats.mtime,
          extension: stats.isFile() ? extname(path) : null,
          basename: basename(path)
        };
    
        // Add helpful hints based on analysis
        if (stats.isDirectory()) {
          result.hint = `This is a directory. Use 'projectPath' parameter for multi-file analysis.`;
        } else {
          result.hint = `This is a file (${result.extension || 'no extension'}). Use 'filePath' parameter for single-file analysis.`;
        }
    
        return result;
        
      } catch (error: any) {
        return {
          exists: false,
          type: 'unknown',
          error: error.message,
          suggestedParameter: 'filePath', // default guess
          hint: `Path not found or inaccessible. Check the path exists and you have permissions.`,
          canRead: false
        };
      }
    }

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/houtini-ai/lm'

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