Skip to main content
Glama
fatwang2

Search1API MCP Server

reasoning

Performs deep reasoning to solve complex problems by analyzing questions and generating thorough solutions.

Instructions

Deep thinking and complex problem solving

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe question or problem that needs deep thinking

Implementation Reference

  • The main handler function for the 'reasoning' tool. Sends the user's content to a DeepSeek R1 model (deepseek-r1-70b-fast-online) via the /v1/chat/completions endpoint and returns the AI response.
    export async function handleReasoning(args: unknown, apiKey?: string) {
      if (!isValidReasoningArgs(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Invalid reasoning arguments"
        );
      }
    
      const { content } = args as ReasoningArgs;
      log("Processing reasoning request");
    
      try {
        // Convert to API required format
        const apiRequestData = {
          model: "deepseek-r1-70b-fast-online",
          messages: [
            {
              role: "user",
              content: content
            }
          ],
          stream: false
        };
    
        const response = await makeRequest<ReasoningResponse>(
          API_CONFIG.ENDPOINTS.REASONING,
          apiRequestData,
          apiKey
        );
        
        // Directly use the correct structure of ReasoningResponse
        const resultText = response.choices && response.choices.length > 0
          ? response.choices[0].message.content
          : JSON.stringify(response);
        
        return {
          content: [{
            type: "text",
            mimeType: "text/plain",
            text: resultText
          }]
        };
      } catch (error) {
        log("Reasoning API error:", error);
        return {
          content: [{
            type: "text",
            mimeType: "text/plain",
            text: `Reasoning API error: ${formatError(error)}`
          }],
          isError: true
        };
      }
    }
  • TypeScript interface for the reasoning tool arguments (content: string).
    export interface ReasoningArgs {
      content: string;
    }
  • TypeScript interface for the reasoning API response (choices with message content).
    export interface ReasoningResponse {
      choices: [{
        message: {
          content: string;
          role: string;
        };
        finish_reason: string;
        index: number;
      }];
    }
  • Type guard function that validates reasoning arguments (checks content is a non-empty string).
    export function isValidReasoningArgs(args: unknown): args is ReasoningArgs {
      if (typeof args !== 'object' || args === null) {
        return false;
      }
    
      const { content } = args as ReasoningArgs;
    
      if (typeof content !== 'string' || content.trim().length === 0) {
        return false;
      }
    
      return true;
    }
  • Registration of the 'reasoning' tool with name, description, and inputSchema (requires string content).
    // Reasoning tool definition
    export const REASONING_TOOL: Tool = {
      name: "reasoning",
      description: "Deep thinking and complex problem solving",
      inputSchema: {
        type: "object",
        properties: {
          content: {
            type: "string",
            description: "The question or problem that needs deep thinking"
          }
        },
        required: ["content"]
      }
    };
  • Export of ALL_TOOLS array which includes REASONING_TOOL.
    // Export all tools
    export const ALL_TOOLS = [
      SEARCH_TOOL,
      NEWS_TOOL,
      CRAWL_TOOL,
      SITEMAP_TOOL,
      REASONING_TOOL,
      TRENDING_TOOL
    ];
  • Dispatch in handleToolCall that routes REASONING_TOOL.name to handleReasoning.
    case REASONING_TOOL.name:
      return await handleReasoning(args, apiKey);
  • API endpoint configuration for REASONING (/v1/chat/completions) on the search1api base URL.
    ENDPOINTS: {
      SEARCH: '/search',
      CRAWL: '/crawl',
      SITEMAP: '/sitemap',
      NEWS: '/news',
      REASONING: '/v1/chat/completions',
      TRENDING: '/trending'
    }
Behavior2/5

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

With no annotations, the description must disclose behavioral traits, but it only states the purpose. It does not mention latency, model used, thinking depth, token limits, or whether the response is a single answer or step-by-step reasoning, leaving the agent with significant ambiguity.

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 very concise at two short sentences, front-loading the core purpose. However, it is so brief that it sacrifices completeness; every sentence is justified but could be expanded to be more helpful.

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

Completeness2/5

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

Given the tool's complexity (single parameter, no output schema), the description is incomplete. It does not explain what 'deep thinking' entails, what the response format is, or how the agent should interpret the output. The agent would have to infer behavior from the name alone.

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 input schema has 100% coverage for the single parameter 'content', and its description in the schema is clear: 'The question or problem that needs deep thinking'. The tool description does not add further semantics beyond what the schema already provides.

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 'Deep thinking and complex problem solving' clearly indicates the tool is for reasoning tasks, which distinguishes it from sibling tools like crawl or search that focus on data retrieval. However, it does not explicitly differentiate itself from other cognitive tools that might exist.

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

Usage Guidelines3/5

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

The description implies the tool should be used for problems requiring deep reasoning, but it provides no explicit guidance on when to use it versus alternatives like search or trending. No exclusion criteria or prerequisites are given.

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/fatwang2/search1api-mcp'

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