Skip to content

Add a timeout configuration parameterΒ #5

@Jandev

Description

@Jandev

I was confronted with a timeout issue when searching through a repository. Mentioned it in this thread of the probe repository: probelabs/probe#36

Setting the timeout value to 90 seconds (and 600 seconds) solved my issue. The repository I was searching through was on disk and ~40MB in size.
It would be great if this timeout value could be exposed as a configuration parameter.

To solve for myself, I've added the timeout: 600 to the search options.

/**
 * Execute a documentation search
 * @param {SearchDocsArgs} args - Search arguments
 * @returns {Promise<string>} Search results
 * @private
 */
async executeDocsSearch(args) {
	try {
		// Always use the configured data directory
		const searchPath = config.dataDir;

		// Create a clean options object
		const options = {
			timeout: 600, // <---- Added this to the options.
			path: searchPath,
			query: args.query,
			maxTokens: 10000 // Set default maxTokens
			// Removed filesOnly, maxResults, session
		};

		console.error("Executing search with options:", JSON.stringify(options, null, 2));

		// Call search with the options object
		const result = await search(options);
		return result;
	} catch (error) {
		console.error('Error executing docs search:', error);
		throw new McpError(
			ErrorCode.MethodNotFound,
			`Error executing docs search: ${error.message || String(error)}`
		);
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions