We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/debugmcpdev/mcp-debugger'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
mock-command-finder.ts•1.66 kB
/**
* Mock implementation of CommandFinder for testing
*/
import type { CommandFinder } from '@debugmcp/adapter-python';
import { CommandNotFoundError } from '@debugmcp/adapter-python';
/**
* Mock command finder for unit tests
*/
export class MockCommandFinder implements CommandFinder {
private responses = new Map<string, string | Error>();
private callHistory: string[] = [];
/**
* Set a response for a specific command
* @param command The command to mock
* @param response The path to return or an error to throw
*/
setResponse(command: string, response: string | Error): void {
this.responses.set(command, response);
}
/**
* Find the full path to an executable command (mocked)
* @param command The command name to find
* @returns The mocked path
* @throws CommandNotFoundError or any configured error
*/
async find(command: string): Promise<string> {
this.callHistory.push(command);
const response = this.responses.get(command);
if (!response) {
throw new CommandNotFoundError(command);
}
if (response instanceof Error) {
throw response;
}
return response;
}
/**
* Clear all configured responses
*/
clearResponses(): void {
this.responses.clear();
}
/**
* Get the history of commands that were looked up
*/
getCallHistory(): string[] {
return [...this.callHistory];
}
/**
* Clear the call history
*/
clearHistory(): void {
this.callHistory = [];
}
/**
* Reset everything (responses and history)
*/
reset(): void {
this.clearResponses();
this.clearHistory();
}
}