Skip to main content
Glama

challenge

Analyze statements critically by identifying assumptions, evaluating evidence, and exploring alternative perspectives to strengthen reasoning.

Instructions

Challenge a statement or assumption with critical thinking

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe user's message or statement to analyze critically. When manually invoked with 'challenge', exclude that prefix - just pass the actual content. For automatic invocations, pass the user's complete message unchanged.

Implementation Reference

  • Implementation of the handleChallenge method in AIToolHandlers class. This is the core logic for the 'challenge' tool: it wraps the input prompt with critical thinking instructions and returns a structured JSON response without invoking an AI model.
    async handleChallenge(params: z.infer<typeof ChallengeSchema>) {
      // Challenge tool doesn't use AI - it just wraps the prompt in critical thinking instructions
      const wrappedPrompt = this.wrapPromptForChallenge(params.prompt);
      
      const responseData = {
        status: "challenge_created",
        original_statement: params.prompt,
        challenge_prompt: wrappedPrompt,
        instructions: (
          "Present the challenge_prompt to yourself and follow its instructions. " +
          "Reassess the statement carefully and critically before responding. " +
          "If, after reflection, you find reasons to disagree or qualify it, explain your reasoning. " +
          "Likewise, if you find reasons to agree, articulate them clearly and justify your agreement."
        ),
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(responseData, null, 2),
          },
        ],
      };
    }
  • src/server.ts:335-342 (registration)
    Registration of the 'challenge' tool on the MCP server, specifying title, description, input schema, and handler invocation via aiHandlers.handleChallenge.
    server.registerTool("challenge", {
      title: "Challenge",
      description: "Challenge a statement or assumption with critical thinking",
      inputSchema: ChallengeSchema.shape,
    }, async (args) => {
      const aiHandlers = await getHandlers();
      return await aiHandlers.handleChallenge(args);
    });
  • Zod schema definition for the 'challenge' tool input, defining the required 'prompt' parameter with descriptive documentation.
    const ChallengeSchema = z.object({
      prompt: z.string().describe("The user's message or statement to analyze critically. When manually invoked with 'challenge', exclude that prefix - just pass the actual content. For automatic invocations, pass the user's complete message unchanged."),
    });
  • Duplicate Zod schema for ChallengeSchema used in the AIToolHandlers class for type inference in handleChallenge method.
    const ChallengeSchema = z.object({
      prompt: z.string().describe("The user's message or statement to analyze critically. When manually invoked with 'challenge', exclude that prefix - just pass the actual content. For automatic invocations, pass the user's complete message unchanged."),
    });
  • Factory function that lazily initializes and returns the AIToolHandlers instance (containing handleChallenge) and ProviderManager, used by all tool registrations including 'challenge'.
    async function getHandlers() {
      if (!handlers) {
        const { ConfigManager } = require("./config/manager");
        const { ProviderManager } = require("./providers/manager");
        const { AIToolHandlers } = require("./handlers/ai-tools");
        
        const configManager = new ConfigManager();
        
        // Load config and set environment variables
        const config = await configManager.getConfig();
        if (config.openai?.apiKey) {
          process.env.OPENAI_API_KEY = config.openai.apiKey;
        }
        if (config.openai?.baseURL) {
          process.env.OPENAI_BASE_URL = config.openai.baseURL;
        }
        if (config.google?.apiKey) {
          process.env.GOOGLE_API_KEY = config.google.apiKey;
        }
        if (config.google?.baseURL) {
          process.env.GOOGLE_BASE_URL = config.google.baseURL;
        }
        if (config.azure?.apiKey) {
          process.env.AZURE_API_KEY = config.azure.apiKey;
        }
        if (config.azure?.baseURL) {
          process.env.AZURE_BASE_URL = config.azure.baseURL;
        }
        if (config.xai?.apiKey) {
          process.env.XAI_API_KEY = config.xai.apiKey;
        }
        if (config.xai?.baseURL) {
          process.env.XAI_BASE_URL = config.xai.baseURL;
        }
        
        providerManager = new ProviderManager(configManager);
        handlers = new AIToolHandlers(providerManager);
      }
      
      return handlers;
    }

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/RealMikeChong/ultra-mcp'

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