Skip to main content
Glama

second_opinion

Analyzes user requests with an LLM to identify critical considerations and provide alternative perspectives for improved decision-making.

Instructions

Provides a second opinion on a user's request by analyzing it with an LLM and listing critical considerations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_requestYesThe user's original request (e.g., 'Explain Python to me' or 'Build a login system')

Implementation Reference

  • The main handler function implementing the core logic: rate limiting, input validation, prompt creation, Deepseek API call, and response handling with optional reasoning.
    export async function handler(args: unknown) {
      // Check rate limit first
      if (!checkRateLimit()) {
        return {
          content: [
            {
              type: 'text',
              text: 'Rate limit exceeded. Please try again later.',
            },
          ],
          isError: true,
        };
      }
    
      try {
        // Type guard for SecondOpinionArgs
        if (!args || typeof args !== 'object' || !('user_request' in args) || 
            typeof args.user_request !== 'string') {
          return {
            content: [
              {
                type: 'text',
                text: 'Missing or invalid user_request parameter.',
              },
            ],
            isError: true,
          };
        }
    
        const typedArgs = args as SecondOpinionArgs;
    
        // Create the complete prompt
        const prompt = createPrompt(PROMPT_TEMPLATE, {
          user_request: typedArgs.user_request
        });
    
        // Make the API call
        const response = await makeDeepseekAPICall(prompt, SYSTEM_PROMPT);
    
        if (response.isError) {
          return {
            content: [
              {
                type: 'text',
                text: `Error generating second opinion: ${response.errorMessage || 'Unknown error'}`,
              },
            ],
            isError: true,
          };
        }
    
        // Return both the reasoning and the final response
        return {
          content: [
            {
              type: 'text',
              text: response.text,
            },
          ],
          // Include the Chain of Thought reasoning if available
          ...(response.reasoning ? {
            reasoning: [
              {
                type: 'text',
                text: `<reasoning>\n${response.reasoning}\n</reasoning>`,
              },
            ],
          } : {}),
        };
      } catch (error) {
        console.error('Second opinion tool error:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error processing request: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
  • ToolDefinition object defining the tool's name, description, and input schema for MCP validation.
    export const definition: ToolDefinition = {
      name: 'second_opinion',
      description: 'Provides a second opinion on a user\'s request by analyzing it with an LLM and listing critical considerations.',
      inputSchema: {
        type: 'object',
        properties: {
          user_request: {
            type: 'string',
            description: 'The user\'s original request (e.g., \'Explain Python to me\' or \'Build a login system\')',
          },
        },
        required: ['user_request'],
      },
    };
  • TypeScript interface for input arguments used in type guarding within the handler.
    export interface SecondOpinionArgs {
      user_request: string;
    }
  • src/server.ts:56-64 (registration)
    Registration of the second_opinion.definition in the MCP server's list of available tools.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        secondOpinion.definition,
        codeReview.definition,
        designCritique.definition,
        writingFeedback.definition,
        brainstormEnhancements.definition,
      ],
    }));
  • src/server.ts:81-89 (registration)
    Switch case dispatching calls to 'second_opinion' tool to the imported handler function with input validation.
    case "second_opinion": {
      if (!args || !('user_request' in args) || typeof args.user_request !== 'string') {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Missing required parameter: user_request"
        );
      }
      response = await secondOpinion.handler({ user_request: args.user_request });
      break;
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool uses an LLM and lists critical considerations, but doesn't describe important traits like whether it's read-only or has side effects, what format the output takes, potential rate limits, or authentication needs. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence that clearly states the tool's function. It's appropriately sized for a simple tool with one parameter, though it could potentially be more front-loaded with additional context about when to use it. There's no wasted verbiage or redundancy.

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 (analyzing requests with LLM), lack of annotations, and no output schema, the description is minimally adequate but has clear gaps. It explains what the tool does but doesn't cover behavioral aspects, usage context, or output format. For a tool that presumably returns LLM-generated analysis, more detail about the nature of the 'critical considerations' would be helpful.

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%, with the single parameter 'user_request' well-documented in the schema. The description doesn't add any meaningful information about parameters beyond what the schema already provides (e.g., it doesn't clarify what constitutes a valid 'user_request' or provide examples beyond those in the schema). With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose4/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: 'Provides a second opinion on a user's request by analyzing it with an LLM and listing critical considerations.' It specifies the action (provides second opinion), method (analyzing with LLM), and output (listing critical considerations). However, it doesn't explicitly differentiate from sibling tools like 'design_critique' or 'writing_feedback' which might also provide analytical feedback.

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

Usage Guidelines2/5

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

The description offers no guidance on when to use this tool versus alternatives. With sibling tools like 'brainstorm_enhancements', 'code_review', 'design_critique', and 'writing_feedback' available, there's no indication of what makes 'second_opinion' distinct or when it's the appropriate choice. The description implies usage for analyzing user requests but doesn't specify context or exclusions.

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

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/cyanheads/mentor-mcp-server'

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