Skip to main content
Glama
PV-Bhat

GemForge-Gemini-Tools-MCP

gemini_reason

Solve complex math, science, and coding problems with transparent, step-by-step reasoning using advanced AI. Ideal for tasks requiring detailed explanations and logical processes.

Instructions

Solves complex problems with step-by-step reasoning using Gemini 2.0 Flash Thinking. Best for math and science problems, coding challenges, and tasks requiring transparent reasoning process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoOptional file path to include with the problem
model_idNoOptional model ID override (advanced users only)
problemYesThe complex problem or question to solve
show_stepsNoWhether to show detailed reasoning steps (default: false)

Implementation Reference

  • Core handler function that executes the gemini_reason tool: validates 'problem' input, selects Gemini model, builds reasoning prompt, calls Gemini API, formats and returns response.
    /** * Handle Gemini reasoning request * @param {Object} request - MCP request * @returns {Promise<Object>} - MCP response */ function handleReason(request) { return __awaiter(this, void 0, void 0, function () { var _a, problem, file_path, model_id, _b, show_steps, modelId, internalRequest, response, error_3; return __generator(this, function (_c) { switch (_c.label) { case 0: _c.trys.push([0, 3, , 4]); // Validate required parameters if (!request.params.arguments || typeof request.params.arguments.problem !== 'string') { throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Problem parameter is required and must be a string'); } _a = request.params.arguments, problem = _a.problem, file_path = _a.file_path, model_id = _a.model_id, _b = _a.show_steps, show_steps = _b === void 0 ? true : _b; modelId = model_id || model_selector_js_1.MODELS.FLASH_THINKING; return [4 /*yield*/, (0, request_builder_js_1.buildReasoningRequest)({ problem: problem, modelId: modelId, filePath: file_path, showSteps: show_steps })]; case 1: internalRequest = _c.sent(); return [4 /*yield*/, executeRequest(modelId, internalRequest)]; case 2: response = _c.sent(); // Format response return [2 /*return*/, formatResponse(response, modelId, { operation: exports.TOOL_NAMES.GEM_REASON, withFile: !!file_path, showSteps: show_steps })]; case 3: error_3 = _c.sent(); console.error('Error in reasoning handler:', error_3); if (error_3 instanceof types_js_1.McpError) { throw error_3; } return [2 /*return*/, { content: [ { type: 'text', text: "Error: ".concat(error_3 instanceof Error ? error_3.message : 'Unknown error') } ], isError: true }]; case 4: return [2 /*return*/]; } }); }); }
  • Input schema and metadata for the gemini_reason tool, registered in the MCP tools/list endpoint.
    name: TOOL_NAMES.GEM_REASON, description: 'Solves complex problems with step-by-step reasoning using Gemini 2.0 Flash Thinking. Best for math and science problems, coding challenges, and tasks requiring transparent reasoning process.', inputSchema: { type: 'object', properties: { problem: { type: 'string', description: 'The complex problem or question to solve' }, file_path: { type: 'string', description: 'Optional file path to include with the problem' }, show_steps: { type: 'boolean', description: 'Whether to show detailed reasoning steps (default: false)', default: false }, model_id: { type: 'string', description: 'Optional model ID override (advanced users only)' } }, required: ['problem'], }, },
  • src/index.ts:206-228 (registration)
    Tool dispatch switch in MCP CallToolRequest handler that routes 'gemini_reason' and TOOL_NAMES.GEM_REASON calls to handleReason function.
    switch (request.params.name) { case TOOL_NAMES.GEM_SEARCH: // Use the alternative direct search handler that works with Flash models return await handleDirectSearchAlt(request); case TOOL_NAMES.GEM_REASON: return await handleReason(request); case TOOL_NAMES.GEM_CODE: return await handleCode(request); case TOOL_NAMES.GEM_FILEOPS: return await handleFileops(request); // Support legacy tool names for backward compatibility case 'gemini_search': // Use the alternative direct search handler that works with Flash models return await handleDirectSearchAlt(request); case 'gemini_reason': return await handleReason(request); default: console.error(`Unknown tool requested: ${request.params.name}`); throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}. Available tools: gemini_search, gemini_reason, gemini_code, gemini_fileops` ); }
  • TOOL_NAMES constant defining GEM_REASON: 'gemini_reason' used for tool name references throughout the codebase.
    export const TOOL_NAMES = { // New specialized toolset GEM_SEARCH: 'gemini_search', // For search-enabled queries (Gemini 2.0 Flash) GEM_REASON: 'gemini_reason', // For complex reasoning (Gemini 2.5 Flash/Pro) GEM_CODE: 'gemini_code', // For coding tasks (Gemini 2.5 Pro) GEM_FILEOPS: 'gemini_fileops', // For file operations (Gemini 2.0 Flash-Lite/1.5 Pro) // Legacy names for backward compatibility - only keeping what's needed SEARCH: 'gemini_search', REASON: 'gemini_reason', ANALYZE_FILE: 'gemini_analyze', RAPID_SEARCH: 'gemini_search' };

Other Tools

Related 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/PV-Bhat/GemForge-MCP'

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