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'
    };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the step-by-step reasoning approach and mentions the 'transparent reasoning process,' which adds value beyond basic functionality. However, it doesn't cover important behavioral aspects like rate limits, authentication requirements, error handling, or what the output looks like (though there's no output schema).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with two well-structured sentences. The first sentence states the core functionality, and the second provides usage guidance. Every word earns its place with no redundancy or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description provides adequate but incomplete coverage. It explains the purpose and usage context well but lacks details about behavioral characteristics, output format, and error handling. With no output schema, the description should ideally mention what kind of response to expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. According to the rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('solves complex problems with step-by-step reasoning') and resources ('using Gemini 2.0 Flash Thinking'). It distinguishes from siblings by specifying it's for 'math and science problems, coding challenges, and tasks requiring transparent reasoning process' rather than code execution, file operations, or search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool ('Best for math and science problems, coding challenges, and tasks requiring transparent reasoning process'), which implicitly suggests alternatives for other types of tasks. However, it doesn't explicitly name sibling tools or state when not to use this tool, keeping it at a 4 rather than a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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