Invalid Schema errors on Azure OpenAI Models #321

Closed
opened 2026-02-16 17:26:11 -05:00 by yindo · 11 comments
Owner

Originally created by @obiMadu on GitHub (Jun 26, 2025).

Originally assigned to: @thdxr on GitHub.

Hi i'm trying to use this with my o4-mini on Azure OpenAI and I get these errors. I put both of them in here because I wonder if they both have the same root cause. The first one seems to be with the edit tool. The second one with mcp tool namings.

Image

Image

Originally created by @obiMadu on GitHub (Jun 26, 2025). Originally assigned to: @thdxr on GitHub. Hi i'm trying to use this with my o4-mini on Azure OpenAI and I get these errors. I put both of them in here because I wonder if they both have the same root cause. The first one seems to be with the edit tool. The second one with mcp tool namings. ![Image](https://github.com/user-attachments/assets/80728077-183f-4749-a06e-c1909901f70d) ![Image](https://github.com/user-attachments/assets/527ed105-6160-45e4-ac36-16e9d89471e7)
yindo added the help-wanted label 2026-02-16 17:26:11 -05:00
yindo closed this issue 2026-02-16 17:26:11 -05:00
Author
Owner

@FaresKi commented on GitHub (Jun 28, 2025):

Hi!
Not an answer but could you tell me specifically where you setup the credentials? Like the deployment name, endpoint and API key? Thanks!

@FaresKi commented on GitHub (Jun 28, 2025): Hi! Not an answer but could you tell me specifically where you setup the credentials? Like the deployment name, endpoint and API key? Thanks!
Author
Owner

@obiMadu commented on GitHub (Jun 28, 2025):

Hi @FaresKi
I setup: AZURE_API_KEY, AZURE_API_VERSION(=2024-12-01-preview), AZURE_RESOURCE_NAME envs
via a wrapper script i use to setup the env for opencode before i run it 👍

@obiMadu commented on GitHub (Jun 28, 2025): Hi @FaresKi I setup: AZURE_API_KEY, AZURE_API_VERSION(=2024-12-01-preview), AZURE_RESOURCE_NAME envs via a wrapper script i use to setup the env for opencode before i run it 👍
Author
Owner

@FaresKi commented on GitHub (Jun 28, 2025):

Awesome.
Now I understand.
It doesn't actually read in env vars but in a .env file... very misleading tbh

@FaresKi commented on GitHub (Jun 28, 2025): Awesome. Now I understand. It doesn't actually read in env vars but in a .env file... very misleading tbh
Author
Owner

@obiMadu commented on GitHub (Jun 28, 2025):

Great, lol, yea, i just export the envs to the environment. The name of the envs go back to models.dev, which goes back to the ai.sdk implementation for Azure OpenAI in case you wanna dig 👍

@obiMadu commented on GitHub (Jun 28, 2025): Great, lol, yea, i just export the envs to the environment. The name of the envs go back to models.dev, which goes back to the ai.sdk implementation for Azure OpenAI in case you wanna dig 👍
Author
Owner

@blubbelgum commented on GitHub (Jun 29, 2025):

@obiMadu have you tried with other models too ? got same error when use o4-mini but not for gpt-4.1. #290

@blubbelgum commented on GitHub (Jun 29, 2025): @obiMadu have you tried with other models too ? got same error when use o4-mini but not for gpt-4.1. #290
Author
Owner

@obiMadu commented on GitHub (Jun 29, 2025):

Not at all @blubbelgum i'm only interested in the high stuff 🤕
Do you find that 4.1 gets any real work done?

@obiMadu commented on GitHub (Jun 29, 2025): Not at all @blubbelgum i'm only interested in the high stuff 🤕 Do you find that 4.1 gets any real work done?
Author
Owner

@gisle commented on GitHub (Jul 2, 2025):

I have a similar problem. I'm also trying to use Azure and get failure with o4-mini, while opencode is happy to talk to gpt-4.1. I talk to Azure through a openai-compatible gateway that sets ?api-version=2024-12-01-preview. I have opencode version
0.1.176.

The error I see is:

INFO  2025-07-02T16:32:56 +0ms service=app name=mcp registering service
ERROR 2025-07-02T16:32:56 +210ms service=session error=AI_APICallError: Invalid schema for function 'bash': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'timeout'. callback error
INFO  2025-07-02T16:32:56 +0ms service=bus type=session.error publishing
INFO  2025-07-02T16:32:56 +1ms service=session session=ses_834040b5bffe0NfLH0ShKzUqJx type=error part
INFO  2025-07-02T16:32:56 +0ms service=session session=ses_834040b5bffe0NfLH0ShKzUqJx type=error unhandled
@gisle commented on GitHub (Jul 2, 2025): I have a similar problem. I'm also trying to use Azure and get failure with `o4-mini`, while opencode is happy to talk to `gpt-4.1`. I talk to Azure through a openai-compatible gateway that sets `?api-version=2024-12-01-preview`. I have opencode version `0.1.176`. The error I see is: ``` INFO 2025-07-02T16:32:56 +0ms service=app name=mcp registering service ERROR 2025-07-02T16:32:56 +210ms service=session error=AI_APICallError: Invalid schema for function 'bash': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'timeout'. callback error INFO 2025-07-02T16:32:56 +0ms service=bus type=session.error publishing INFO 2025-07-02T16:32:56 +1ms service=session session=ses_834040b5bffe0NfLH0ShKzUqJx type=error part INFO 2025-07-02T16:32:56 +0ms service=session session=ses_834040b5bffe0NfLH0ShKzUqJx type=error unhandled ```
Author
Owner

@thdxr commented on GitHub (Jul 2, 2025):

i'm not sure what's happening here i think someone would have to dig further. you can see in provider.ts under TOOL_MAPPING we do modify the schema for certain providers

it's possible we shouldn't be doing this for azure or we're doing it wrong entirely. this should probably be implemented as a provider/transform.ts concept

@thdxr commented on GitHub (Jul 2, 2025): i'm not sure what's happening here i think someone would have to dig further. you can see in `provider.ts` under `TOOL_MAPPING` we do modify the schema for certain providers<br><br>it's possible we shouldn't be doing this for azure or we're doing it wrong entirely. this should probably be implemented as a provider/transform.ts concept
Author
Owner

@jessevdp commented on GitHub (Jul 17, 2025):

I'm running into a similar error:

{
  "error": {
    "message": "Invalid schema for function 'bash': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'timeout'.",
    "type": "invalid_request_error",
    "param": "tools[0].function.parameters",
    "code": "invalid_function_parameters"
  }
}

This happens when I use o3 (or a similar model) from my custom provider (proxy for Azure & other hosts).

Request body

{
  "model": "o3",
  "messages": [
    {
      "role": "developer",
      "content": "You are an agent known as opencode - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nI want you to fully solve this autonomously before coming back to me.\n\nOnly terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence. This will help them understand what you are doing and why.\n\nIf the user request is \"resume\" or \"continue\" or \"try again\", check the previous conversation history to see what the next incomplete step in the todo list is. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all items are checked off. Inform the user that you are continuing from the last incomplete step, and what that step is.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.\n\n# Workflow\n\n1. Understand the problem deeply. Carefully read the issue and think critically about what is required.\n2. Investigate the codebase. Explore relevant files, search for key functions, and gather context.\n3. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using standard markdown format. Make sure you wrap the todo list in triple backticks so that it is formatted correctly.\n4. Implement the fix incrementally. Make small, testable code changes.\n5. Debug as needed. Use debugging techniques to isolate and resolve issues.\n6. Test frequently. Run tests after each change to verify correctness.\n7. Iterate until the root cause is fixed and all tests pass.\n8. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.\n\nRefer to the detailed sections below for more information on each step.\n\n## 1. Deeply Understand the Problem\nCarefully read the issue and think hard about a plan to solve it before coding.\n\n## 2. Codebase Investigation\n- Explore relevant files and directories.\n- Search for key functions, classes, or variables related to the issue.\n- Read and understand relevant code snippets.\n- Identify the root cause of the problem.\n- Validate and update your understanding continuously as you gather more context.\n\n## 3. Fetch Provided URLs\n- If the user provides a URL, use the `functions.fetch_webpage` tool to retrieve the content of the provided URL.\n- After fetching, review the content returned by the fetch tool.\n- If you find any additional URLs or links that are relevant, use the `fetch_webpage` tool again to retrieve those links.\n- Recursively gather all relevant information by fetching additional links until you have all the information you need.\n\n## 4. Develop a Detailed Plan \n- Outline a specific, simple, and verifiable sequence of steps to fix the problem.\n- Create a todo list in markdown format to track your progress.\n- Each time you complete a step, check it off using `[x]` syntax.\n- Each time you check off a step, display the updated todo list to the user.\n- Make sure that you ACTUALLY continue on to the next step after checkin off a step instead of ending your turn and asking the user what they want to do next.\n\n## 5. Making Code Changes\n- Before editing, always read the relevant file contents or section to ensure complete context.\n- Always read 2000 lines of code at a time to ensure you have enough context.\n- If a patch is not applied correctly, attempt to reapply it.\n- Make small, testable, incremental changes that logically follow from your investigation and plan.\n\n## 6. Debugging\n- Make code changes only if you have high confidence they can solve the problem\n- When debugging, try to determine the root cause rather than addressing symptoms\n- Debug for as long as needed to identify the root cause and identify a fix\n- Use the #problems tool to check for any problems in the code\n- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening\n- To test hypotheses, you can also add test statements or functions\n- Revisit your assumptions if unexpected behavior occurs.\n\n# Fetch Webpage\nUse the `webfetch` tool when the user provides a URL. Follow these steps exactly.\n\n1. Use the `webfetch` tool to retrieve the content of the provided URL.\n2. After fetching, review the content returned by the fetch tool.\n3. If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.\n4. Go back to step 2 and repeat until you have all the information you need.\n\nIMPORTANT: Recursively fetching links is crucial. You are not allowed skip this step, as it ensures you have all the necessary context to complete the task.\n\n# How to create a Todo List\nUse the following format to create a todo list:\n```markdown\n- [ ] Step 1: Description of the first step\n- [ ] Step 2: Description of the second step\n- [ ] Step 3: Description of the third step\n```\n\nDo not ever use HTML tags or any other formatting for the todo list, as it will not be rendered correctly. Always use the markdown format shown above.\n\n# Creating Files\nEach time you are going to create a file, use a single concise sentence inform the user of what you are creating and why.\n\n# Reading Files\n- Read 2000 lines of code at a time to ensure that you have enough context. \n- Each time you read a file, use a single concise sentence to inform the user of what you are reading and why.\n"
    },
    {
      "role": "developer",
      "content": "Here is some useful information about the environment you are running in:\n<env>\n  Working directory: /Users/jessevanderpluijm/.config/opencode\n  Is directory a git repo: no\n  Platform: darwin\n  Today's date: Wed Jul 16 2025\n</env>\n<project>\n  \n</project>"
    },
    {
      "role": "user",
      "content": "Test. Is this thing on?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "bash",
        "description": "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n   - If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location\n   - For example, before running \"mkdir foo/bar\", first use LS to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n   - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n   - Examples of proper quoting:\n     - cd \"/Users/name/My Documents\" (correct)\n     - cd /Users/name/My Documents (incorrect - will fail)\n     - python \"/path/with spaces/script.py\" (correct)\n     - python /path/with spaces/script.py (incorrect - will fail)\n   - After ensuring proper quoting, execute the command.\n   - Capture the output of the command.\n\nUsage notes:\n  - The command argument is required.\n  - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n  - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n  - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n  - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files.\n  - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n  - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n  - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n    <good-example>\n    pytest /foo/bar/tests\n    </good-example>\n    <bad-example>\n    cd /foo/bar && pytest tests\n    </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n   - Run a git status command to see all untracked files.\n   - Run a git diff command to see both staged and unstaged changes that will be committed.\n   - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Add relevant untracked files to the staging area.\n   - Create the commit with a message ending with:\n   🤖 Generated with [opencode](https://opencode.ai)\n\n   Co-Authored-By: opencode <noreply@opencode.ai>\n   - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:\n<example>\ngit commit -m \"$(cat <<'EOF'\n   Commit message here.\n\n   🤖 Generated with [opencode](https://opencode.ai)\n\n   Co-Authored-By: opencode <noreply@opencode.ai>\n   EOF\n   )\"\n</example>\n\n# Creating pull requests\nUse the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n   - Run a git status command to see all untracked files\n   - Run a git diff command to see both staged and unstaged changes that will be committed\n   - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote\n   - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Create new branch if needed\n   - Push to remote with -u flag if needed\n   - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\n\n## Test plan\n[Checklist of TODOs for testing the pull request...]\n\n🤖 Generated with [opencode](https://opencode.ai)\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n",
        "parameters": {
          "type": "object",
          "properties": {
            "command": {
              "type": "string",
              "description": "The command to execute"
            },
            "timeout": {
              "type": "number",
              "minimum": 0,
              "maximum": 600000,
              "description": "Optional timeout in milliseconds"
            },
            "description": {
              "type": "string",
              "description": "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'"
            }
          },
          "required": [
            "command",
            "description"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "edit",
        "description": "Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "filePath": {
              "type": "string",
              "description": "The absolute path to the file to modify"
            },
            "oldString": {
              "type": "string",
              "description": "The text to replace"
            },
            "newString": {
              "type": "string",
              "description": "The text to replace it with (must be different from oldString)"
            },
            "replaceAll": {
              "type": "boolean",
              "description": "Replace all occurrences of oldString (default false)"
            }
          },
          "required": [
            "filePath",
            "oldString",
            "newString"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "webfetch",
        "description": "- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n  - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. All MCP-provided tools start with \"mcp__\".\n  - The URL must be a fully-formed valid URL\n  - HTTP URLs will be automatically upgraded to HTTPS\n  - The prompt should describe what information you want to extract from the page\n  - This tool is read-only and does not modify any files\n  - Results may be summarized if the content is very large\n  - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL to fetch content from"
            },
            "format": {
              "type": "string",
              "enum": [
                "text",
                "markdown",
                "html"
              ],
              "description": "The format to return the content in (text, markdown, or html)"
            },
            "timeout": {
              "type": "number",
              "minimum": 0,
              "maximum": 120,
              "description": "Optional timeout in seconds (max 120)"
            }
          },
          "required": [
            "url",
            "format"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "glob",
        "description": "- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "pattern": {
              "type": "string",
              "description": "The glob pattern to match files against"
            },
            "path": {
              "type": "string",
              "description": "The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided."
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "grep",
        "description": "- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n",
        "parameters": {
          "type": "object",
          "properties": {
            "pattern": {
              "type": "string",
              "description": "The regex pattern to search for in file contents"
            },
            "path": {
              "type": "string",
              "description": "The directory to search in. Defaults to the current working directory."
            },
            "include": {
              "type": "string",
              "description": "File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")"
            }
          },
          "required": [
            "pattern"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "list",
        "description": "Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "The absolute path to the directory to list (must be absolute, not relative)"
            },
            "ignore": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "List of glob patterns to ignore"
            }
          },
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "patch",
        "description": "do not use\n",
        "parameters": {
          "type": "object",
          "properties": {
            "patchText": {
              "type": "string",
              "description": "The full patch text that describes all changes to be made"
            }
          },
          "required": [
            "patchText"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "read",
        "description": "Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool allows opencode to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as opencode is a multimodal LLM.\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png\n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "filePath": {
              "type": "string",
              "description": "The path to the file to read"
            },
            "offset": {
              "type": "number",
              "description": "The line number to start reading from (0-based)"
            },
            "limit": {
              "type": "number",
              "description": "The number of lines to read (defaults to 2000)"
            }
          },
          "required": [
            "filePath"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "write",
        "description": "Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n",
        "parameters": {
          "type": "object",
          "properties": {
            "filePath": {
              "type": "string",
              "description": "The absolute path to the file to write (must be absolute, not relative)"
            },
            "content": {
              "type": "string",
              "description": "The content to write to the file"
            }
          },
          "required": [
            "filePath",
            "content"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "todowrite",
        "description": "Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n   - pending: Task not yet started\n   - in_progress: Currently working on (limit to ONE task at a time)\n   - completed: Task finished successfully\n   - cancelled: Task no longer needed\n\n2. **Task Management**:\n   - Update task status in real-time as you work\n   - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n   - Only have ONE task in_progress at any time\n   - Complete current tasks before starting new ones\n   - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n   - Create specific, actionable items\n   - Break complex tasks into smaller, manageable steps\n   - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n",
        "parameters": {
          "type": "object",
          "properties": {
            "todos": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Brief description of the task"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "in_progress",
                      "completed",
                      "cancelled"
                    ],
                    "description": "Current status of the task"
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "high",
                      "medium",
                      "low"
                    ],
                    "description": "Priority level of the task"
                  },
                  "id": {
                    "type": "string",
                    "description": "Unique identifier for the todo item"
                  }
                },
                "required": [
                  "content",
                  "status",
                  "priority",
                  "id"
                ],
                "additionalProperties": false
              },
              "description": "The updated todo list"
            }
          },
          "required": [
            "todos"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "todoread",
        "description": "Use this tool to read your todo list",
        "parameters": {
          "type": "object",
          "properties": {},
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "task",
        "description": "Launch a new agent that has access to the following tools: Bash, Glob, Grep, LS, Read, Edit, MultiEdit, Write, NotebookRead, NotebookEdit, WebFetch, TodoRead, TodoWrite, WebSearch. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use the Agent tool to perform the search for you.\n\nWhen to use the Agent tool:\n- If you are searching for a keyword like \"config\" or \"logger\", or for questions like \"which file does X?\", the Agent tool is strongly recommended\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n",
        "parameters": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string",
              "description": "A short (3-5 words) description of the task"
            },
            "prompt": {
              "type": "string",
              "description": "The task for the agent to perform"
            }
          },
          "required": [
            "description",
            "prompt"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "open-web-search_search",
        "description": "Search the web using multiple engines (e.g., Baidu, Bing, DuckDuckGo, CSDN, Exa, Brave) with no API key required",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "minLength": 1
            },
            "limit": {
              "type": "number",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            },
            "engines": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "baidu",
                  "bing",
                  "csdn",
                  "duckduckgo",
                  "exa",
                  "brave"
                ]
              },
              "minItems": 1,
              "default": [
                "duckduckgo"
              ]
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "open-web-search_fetchLinuxDoArticle",
        "description": "Fetch full article content from a linux.do post URL",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": [
            "url"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    },
    {
      "type": "function",
      "function": {
        "name": "open-web-search_fetchCsdnArticle",
        "description": "Fetch full article content from a csdn post URL",
        "parameters": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": [
            "url"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        },
        "strict": true
      }
    }
  ],
  "tool_choice": "auto",
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}

My custom provider:

{
  "provider": {
    "bonzai": {
      "name": "Bonzai",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://url-for-provider.com",
        "headers": {
          "api-key": "{file:/path/to/secret.key}"
        }
      },
      "models": {
        "claude-3-7-sonnet": {
          "name": "Anthropic Claude 3-7 sonnet"
        },
        "claude-4-sonnet": {
          "name": "Anthropic Claude 4 sonnet"
        },
        "gpt-4o": {
          "name": "OpenAI gpt 4o"
        },
        "gpt-4o-mini": {
          "name": "OpenAI gpt 4o mini"
        },
        "o1": {
          "name": "OpenAI o1"
        },
        "o3": {
          "name": "OpenAI o3"
        },
        "o3-mini": {
          "name": "OpenAI o3 mini"
        },
        "o4-mini": {
          "name": "OpenAI o4 mini"
        },
        "gemini-2.5-pro": {
          "name": "Google gemini 2.5 pro"
        },
      }
    }
  }
}
@jessevdp commented on GitHub (Jul 17, 2025): I'm running into a similar error: ```json { "error": { "message": "Invalid schema for function 'bash': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'timeout'.", "type": "invalid_request_error", "param": "tools[0].function.parameters", "code": "invalid_function_parameters" } } ``` This happens when I use o3 (or a similar model) from my custom provider (proxy for Azure & other hosts). <details><summary>Request body</summary> <p> ```json { "model": "o3", "messages": [ { "role": "developer", "content": "You are an agent known as opencode - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nI want you to fully solve this autonomously before coming back to me.\n\nOnly terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence. This will help them understand what you are doing and why.\n\nIf the user request is \"resume\" or \"continue\" or \"try again\", check the previous conversation history to see what the next incomplete step in the todo list is. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all items are checked off. Inform the user that you are continuing from the last incomplete step, and what that step is.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.\n\n# Workflow\n\n1. Understand the problem deeply. Carefully read the issue and think critically about what is required.\n2. Investigate the codebase. Explore relevant files, search for key functions, and gather context.\n3. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using standard markdown format. Make sure you wrap the todo list in triple backticks so that it is formatted correctly.\n4. Implement the fix incrementally. Make small, testable code changes.\n5. Debug as needed. Use debugging techniques to isolate and resolve issues.\n6. Test frequently. Run tests after each change to verify correctness.\n7. Iterate until the root cause is fixed and all tests pass.\n8. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.\n\nRefer to the detailed sections below for more information on each step.\n\n## 1. Deeply Understand the Problem\nCarefully read the issue and think hard about a plan to solve it before coding.\n\n## 2. Codebase Investigation\n- Explore relevant files and directories.\n- Search for key functions, classes, or variables related to the issue.\n- Read and understand relevant code snippets.\n- Identify the root cause of the problem.\n- Validate and update your understanding continuously as you gather more context.\n\n## 3. Fetch Provided URLs\n- If the user provides a URL, use the `functions.fetch_webpage` tool to retrieve the content of the provided URL.\n- After fetching, review the content returned by the fetch tool.\n- If you find any additional URLs or links that are relevant, use the `fetch_webpage` tool again to retrieve those links.\n- Recursively gather all relevant information by fetching additional links until you have all the information you need.\n\n## 4. Develop a Detailed Plan \n- Outline a specific, simple, and verifiable sequence of steps to fix the problem.\n- Create a todo list in markdown format to track your progress.\n- Each time you complete a step, check it off using `[x]` syntax.\n- Each time you check off a step, display the updated todo list to the user.\n- Make sure that you ACTUALLY continue on to the next step after checkin off a step instead of ending your turn and asking the user what they want to do next.\n\n## 5. Making Code Changes\n- Before editing, always read the relevant file contents or section to ensure complete context.\n- Always read 2000 lines of code at a time to ensure you have enough context.\n- If a patch is not applied correctly, attempt to reapply it.\n- Make small, testable, incremental changes that logically follow from your investigation and plan.\n\n## 6. Debugging\n- Make code changes only if you have high confidence they can solve the problem\n- When debugging, try to determine the root cause rather than addressing symptoms\n- Debug for as long as needed to identify the root cause and identify a fix\n- Use the #problems tool to check for any problems in the code\n- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening\n- To test hypotheses, you can also add test statements or functions\n- Revisit your assumptions if unexpected behavior occurs.\n\n# Fetch Webpage\nUse the `webfetch` tool when the user provides a URL. Follow these steps exactly.\n\n1. Use the `webfetch` tool to retrieve the content of the provided URL.\n2. After fetching, review the content returned by the fetch tool.\n3. If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.\n4. Go back to step 2 and repeat until you have all the information you need.\n\nIMPORTANT: Recursively fetching links is crucial. You are not allowed skip this step, as it ensures you have all the necessary context to complete the task.\n\n# How to create a Todo List\nUse the following format to create a todo list:\n```markdown\n- [ ] Step 1: Description of the first step\n- [ ] Step 2: Description of the second step\n- [ ] Step 3: Description of the third step\n```\n\nDo not ever use HTML tags or any other formatting for the todo list, as it will not be rendered correctly. Always use the markdown format shown above.\n\n# Creating Files\nEach time you are going to create a file, use a single concise sentence inform the user of what you are creating and why.\n\n# Reading Files\n- Read 2000 lines of code at a time to ensure that you have enough context. \n- Each time you read a file, use a single concise sentence to inform the user of what you are reading and why.\n" }, { "role": "developer", "content": "Here is some useful information about the environment you are running in:\n<env>\n Working directory: /Users/jessevanderpluijm/.config/opencode\n Is directory a git repo: no\n Platform: darwin\n Today's date: Wed Jul 16 2025\n</env>\n<project>\n \n</project>" }, { "role": "user", "content": "Test. Is this thing on?" } ], "tools": [ { "type": "function", "function": { "name": "bash", "description": "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n - If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location\n - For example, before running \"mkdir foo/bar\", first use LS to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - Examples of proper quoting:\n - cd \"/Users/name/My Documents\" (correct)\n - cd /Users/name/My Documents (incorrect - will fail)\n - python \"/path/with spaces/script.py\" (correct)\n - python /path/with spaces/script.py (incorrect - will fail)\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files.\n - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n <good-example>\n pytest /foo/bar/tests\n </good-example>\n <bad-example>\n cd /foo/bar && pytest tests\n </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n - Run a git status command to see all untracked files.\n - Run a git diff command to see both staged and unstaged changes that will be committed.\n - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Add relevant untracked files to the staging area.\n - Create the commit with a message ending with:\n 🤖 Generated with [opencode](https://opencode.ai)\n\n Co-Authored-By: opencode <noreply@opencode.ai>\n - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:\n<example>\ngit commit -m \"$(cat <<'EOF'\n Commit message here.\n\n 🤖 Generated with [opencode](https://opencode.ai)\n\n Co-Authored-By: opencode <noreply@opencode.ai>\n EOF\n )\"\n</example>\n\n# Creating pull requests\nUse the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n - Run a git status command to see all untracked files\n - Run a git diff command to see both staged and unstaged changes that will be committed\n - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote\n - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Create new branch if needed\n - Push to remote with -u flag if needed\n - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\n\n## Test plan\n[Checklist of TODOs for testing the pull request...]\n\n🤖 Generated with [opencode](https://opencode.ai)\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n", "parameters": { "type": "object", "properties": { "command": { "type": "string", "description": "The command to execute" }, "timeout": { "type": "number", "minimum": 0, "maximum": 600000, "description": "Optional timeout in milliseconds" }, "description": { "type": "string", "description": "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'" } }, "required": [ "command", "description" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "edit", "description": "Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n", "parameters": { "type": "object", "properties": { "filePath": { "type": "string", "description": "The absolute path to the file to modify" }, "oldString": { "type": "string", "description": "The text to replace" }, "newString": { "type": "string", "description": "The text to replace it with (must be different from oldString)" }, "replaceAll": { "type": "boolean", "description": "Replace all occurrences of oldString (default false)" } }, "required": [ "filePath", "oldString", "newString" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "webfetch", "description": "- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. All MCP-provided tools start with \"mcp__\".\n - The URL must be a fully-formed valid URL\n - HTTP URLs will be automatically upgraded to HTTPS\n - The prompt should describe what information you want to extract from the page\n - This tool is read-only and does not modify any files\n - Results may be summarized if the content is very large\n - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n", "parameters": { "type": "object", "properties": { "url": { "type": "string", "description": "The URL to fetch content from" }, "format": { "type": "string", "enum": [ "text", "markdown", "html" ], "description": "The format to return the content in (text, markdown, or html)" }, "timeout": { "type": "number", "minimum": 0, "maximum": 120, "description": "Optional timeout in seconds (max 120)" } }, "required": [ "url", "format" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "glob", "description": "- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n", "parameters": { "type": "object", "properties": { "pattern": { "type": "string", "description": "The glob pattern to match files against" }, "path": { "type": "string", "description": "The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided." } }, "required": [ "pattern" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "grep", "description": "- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n", "parameters": { "type": "object", "properties": { "pattern": { "type": "string", "description": "The regex pattern to search for in file contents" }, "path": { "type": "string", "description": "The directory to search in. Defaults to the current working directory." }, "include": { "type": "string", "description": "File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")" } }, "required": [ "pattern" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "list", "description": "Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n", "parameters": { "type": "object", "properties": { "path": { "type": "string", "description": "The absolute path to the directory to list (must be absolute, not relative)" }, "ignore": { "type": "array", "items": { "type": "string" }, "description": "List of glob patterns to ignore" } }, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "patch", "description": "do not use\n", "parameters": { "type": "object", "properties": { "patchText": { "type": "string", "description": "The full patch text that describes all changes to be made" } }, "required": [ "patchText" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "read", "description": "Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool allows opencode to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as opencode is a multimodal LLM.\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png\n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n", "parameters": { "type": "object", "properties": { "filePath": { "type": "string", "description": "The path to the file to read" }, "offset": { "type": "number", "description": "The line number to start reading from (0-based)" }, "limit": { "type": "number", "description": "The number of lines to read (defaults to 2000)" } }, "required": [ "filePath" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "write", "description": "Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n", "parameters": { "type": "object", "properties": { "filePath": { "type": "string", "description": "The absolute path to the file to write (must be absolute, not relative)" }, "content": { "type": "string", "description": "The content to write to the file" } }, "required": [ "filePath", "content" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "todowrite", "description": "Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n - cancelled: Task no longer needed\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Only have ONE task in_progress at any time\n - Complete current tasks before starting new ones\n - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n", "parameters": { "type": "object", "properties": { "todos": { "type": "array", "items": { "type": "object", "properties": { "content": { "type": "string", "minLength": 1, "description": "Brief description of the task" }, "status": { "type": "string", "enum": [ "pending", "in_progress", "completed", "cancelled" ], "description": "Current status of the task" }, "priority": { "type": "string", "enum": [ "high", "medium", "low" ], "description": "Priority level of the task" }, "id": { "type": "string", "description": "Unique identifier for the todo item" } }, "required": [ "content", "status", "priority", "id" ], "additionalProperties": false }, "description": "The updated todo list" } }, "required": [ "todos" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "todoread", "description": "Use this tool to read your todo list", "parameters": { "type": "object", "properties": {}, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "task", "description": "Launch a new agent that has access to the following tools: Bash, Glob, Grep, LS, Read, Edit, MultiEdit, Write, NotebookRead, NotebookEdit, WebFetch, TodoRead, TodoWrite, WebSearch. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use the Agent tool to perform the search for you.\n\nWhen to use the Agent tool:\n- If you are searching for a keyword like \"config\" or \"logger\", or for questions like \"which file does X?\", the Agent tool is strongly recommended\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n", "parameters": { "type": "object", "properties": { "description": { "type": "string", "description": "A short (3-5 words) description of the task" }, "prompt": { "type": "string", "description": "The task for the agent to perform" } }, "required": [ "description", "prompt" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "open-web-search_search", "description": "Search the web using multiple engines (e.g., Baidu, Bing, DuckDuckGo, CSDN, Exa, Brave) with no API key required", "parameters": { "type": "object", "properties": { "query": { "type": "string", "minLength": 1 }, "limit": { "type": "number", "minimum": 1, "maximum": 50, "default": 10 }, "engines": { "type": "array", "items": { "type": "string", "enum": [ "baidu", "bing", "csdn", "duckduckgo", "exa", "brave" ] }, "minItems": 1, "default": [ "duckduckgo" ] } }, "required": [ "query" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "open-web-search_fetchLinuxDoArticle", "description": "Fetch full article content from a linux.do post URL", "parameters": { "type": "object", "properties": { "url": { "type": "string", "format": "uri" } }, "required": [ "url" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } }, { "type": "function", "function": { "name": "open-web-search_fetchCsdnArticle", "description": "Fetch full article content from a csdn post URL", "parameters": { "type": "object", "properties": { "url": { "type": "string", "format": "uri" } }, "required": [ "url" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, "strict": true } } ], "tool_choice": "auto", "stream": true, "stream_options": { "include_usage": true } } ``` </p> </details> My custom provider: ```json { "provider": { "bonzai": { "name": "Bonzai", "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://url-for-provider.com", "headers": { "api-key": "{file:/path/to/secret.key}" } }, "models": { "claude-3-7-sonnet": { "name": "Anthropic Claude 3-7 sonnet" }, "claude-4-sonnet": { "name": "Anthropic Claude 4 sonnet" }, "gpt-4o": { "name": "OpenAI gpt 4o" }, "gpt-4o-mini": { "name": "OpenAI gpt 4o mini" }, "o1": { "name": "OpenAI o1" }, "o3": { "name": "OpenAI o3" }, "o3-mini": { "name": "OpenAI o3 mini" }, "o4-mini": { "name": "OpenAI o4 mini" }, "gemini-2.5-pro": { "name": "Google gemini 2.5 pro" }, } } } } ```
Author
Owner

@waldekmastykarz commented on GitHub (Jul 24, 2025):

it's possible we shouldn't be doing this for azure or we're doing it wrong entirely. this should probably be implemented as a provider/transform.ts concept

I ran into the same issue and can confirm that passing parameters as-is (parameters: t.parameters,) works on Azure with GPT 4.1 as expected. Happy to submit a PR with this change.

@waldekmastykarz commented on GitHub (Jul 24, 2025): > it's possible we shouldn't be doing this for azure or we're doing it wrong entirely. this should probably be implemented as a provider/transform.ts concept I ran into the same issue and can confirm that passing parameters as-is (`parameters: t.parameters,`) works on Azure with GPT 4.1 as expected. Happy to submit a PR with this change.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#321