Skip to main content
Glama

consult_oracle

Get expert AI analysis for complex problem-solving, architectural decisions, and design tradeoffs when confidence is low or planning requires multiple considerations.

Instructions

Consult the oracle (gpt-5.1-codex-mini) via codex CLI with medium-level reasoning. The oracle provides expert reasoning and analysis for complex problem-solving. Use when: (1) planning complex tasks with multiple tradeoffs, (2) you are <=90% confident in your approach, (3) you need analysis of architectural decisions or design patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe question or problem to consult the oracle about. Be specific about context, constraints, and what decision or analysis you need.

Implementation Reference

  • The main execution logic for the 'consult_oracle' tool. It extracts the prompt, tries multiple oracle configurations and models in sequence with fallback logic, invokes the CLI using helpers, and returns the stdout as text content or accumulated errors if all fail.
    if (name === "consult_oracle") {
      const prompt = (args as Record<string, unknown>).prompt as string;
      const errors: string[] = [];
    
      // Try each oracle in sequence, and within each oracle try each model (fallback)
      for (let oracleIdx = 0; oracleIdx < oracleConfigs.length; oracleIdx++) {
        const cfg = oracleConfigs[oracleIdx];
        const models = normalizeModels(cfg);
    
        for (let modelIdx = 0; modelIdx < models.length; modelIdx++) {
          const model = models[modelIdx];
          try {
            const cmdName = cfg.command || "oracle";
            const spawnArgs = buildOracleArgs(
              cmdName,
              model,
              cfg.reasoning,
              prompt
            );
    
            const result = invokeOracle(cmdName, spawnArgs);
    
            if (result.error) {
              throw result.error;
            }
    
            if (result.status !== 0) {
              throw new Error(`Command failed with status ${result.status}`);
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: result.stdout,
                } as TextContent,
              ],
            };
          } catch (error) {
            const errorMsg = error instanceof Error ? error.message : String(error);
            errors.push(
              `Oracle ${oracleIdx + 1}, model ${modelIdx + 1} (${model}): ${errorMsg}`
            );
          }
        }
      }
    
      // All oracles and models failed, return accumulated errors
      return {
        content: [
          {
            type: "text",
            text: `All oracles failed:\n${errors.join("\n")}`,
          } as TextContent,
        ],
        isError: true,
      };
    }
  • src/index.ts:135-152 (registration)
    Registers the 'consult_oracle' tool in the ListToolsRequestSchema handler, including its name, dynamic description based on config, and input schema requiring a 'prompt' string.
    return {
      tools: [
        {
          name: "consult_oracle",
          description: fullDescription,
          inputSchema: {
            type: "object",
            properties: {
              prompt: {
                type: "string",
                description: "The question or problem to consult the oracle about. Be specific about context, constraints, and what decision or analysis you need.",
              },
            },
            required: ["prompt"],
          },
        },
      ],
    };
  • Input schema definition for the 'consult_oracle' tool, specifying an object with a required 'prompt' string property.
      inputSchema: {
        type: "object",
        properties: {
          prompt: {
            type: "string",
            description: "The question or problem to consult the oracle about. Be specific about context, constraints, and what decision or analysis you need.",
          },
        },
        required: ["prompt"],
      },
    },
  • Helper function that invokes the oracle CLI command using Node.js child_process.spawnSync synchronously, returning stdout, exit status, and any error.
    export function invokeOracle(
      command: string,
      args: string[]
    ): { stdout: string; status: number; error?: Error } {
      const result = spawnSync(command, args, { encoding: "utf-8" });
    
      return {
        stdout: result.stdout,
        status: result.status ?? 1,
        error: result.error,
      };
    }
  • Helper function to construct CLI argument arrays tailored to different oracle commands (codex, gemini, claude), handling model, reasoning level, and prompt.
    export function buildOracleArgs(
      command: string,
      model: string,
      reasoning: string | undefined,
      prompt: string
    ): string[] {
      if (command === "codex" || command.includes("codex")) {
        // Codex: codex exec --model <model> [-c reasoning_level=<level>] "<prompt>"
        const args = ["exec", "--model", model];
        if (reasoning) {
          args.push("-c", `reasoning_level=${reasoning}`);
        }
        args.push(prompt);
        return args;
      } else if (command === "gemini" || command.includes("gemini")) {
        // Gemini: gemini -p --model <model> "<prompt>"
        return ["-p", "--model", model, prompt];
      } else {
        // Claude: claude -p --model <model> "<prompt>"
        return ["-p", "--model", model, prompt];
      }
    }
Behavior3/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. It mentions 'medium-level reasoning' and 'expert reasoning and analysis,' which gives some behavioral context, but lacks details on limitations, costs, rate limits, or response format. For a tool with no annotations, this is adequate but leaves gaps in operational transparency.

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 front-loaded with the core purpose, followed by specific usage guidelines, all in three concise sentences. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

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

Completeness4/5

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

Given the tool's complexity (consulting an AI model) and no output schema, the description does well by covering purpose and usage scenarios. However, it lacks details on behavioral traits like response handling or error cases, which could be important for an AI agent. With no annotations, it's mostly complete but has minor gaps.

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% description coverage for the single parameter 'prompt,' so the schema already documents it well. The description does not add any parameter-specific details beyond what the schema provides, such as examples or formatting tips, resulting in a baseline score of 3.

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: 'Consult the oracle (gpt-5.1-codex-mini) via codex CLI with medium-level reasoning. The oracle provides expert reasoning and analysis for complex problem-solving.' It specifies the action (consult), resource (oracle), and distinguishes it by mentioning the specific model and CLI, which is comprehensive given no sibling tools exist.

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

Usage Guidelines5/5

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

The description explicitly lists three scenarios for when to use this tool: '(1) planning complex tasks with multiple tradeoffs, (2) you are <=90% confident in your approach, (3) you need analysis of architectural decisions or design patterns.' This provides clear, actionable guidance on appropriate contexts, with no need for sibling tool differentiation.

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/becksclair/oracle-mcp'

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