Skip to content

foundry local ai - Invalid Open AI JSON requested error: [Provided tools are not defined using an OpenAI-compatible tool definition format per tool. #283518

@ahmedali91

Description

@ahmedali91

UserAgent:H/JS 5.12.2 Command:OpenAIChatCompletions Status:Failure Direct:True Time:8ms
2025-12-15 09:25:23.460 [info] Error: Microsoft.Neutron.OpenAI.Delegates.OpenAIApi [0] 2025-12-15T09:25:23.457457+03:00 Provided tools are not defined using an OpenAI-compatible tool definition: [{"type":"function","function":{"name":"activate_import_analysis_and_dependency_management","description":"Call this tool when you need access to a new category of tools. The category of tools is described as follows:\n\nThis group of tools is designed to assist users in analyzing and managing Python imports and dependencies within their projects. The 'Analyze imports across workspace user files' tool provides insights into the top-level modules imported in user files, helping to identify missing dependencies and understand project import patterns. This is crucial for maintaining a clean and functional codebase. The 'Get available top-level modules from installed Python packages in environment' tool complements this by allowing users to check which packages are installed and available for import. Together, these tools facilitate a comprehensive understanding of project dependencies, enabling users to troubleshoot import issues and ensure that all necessary modules are correctly referenced in their code.\n\nBe sure to call this tool if you need a capability related to the above."}},{"type":"function","function":{"name":"activate_python_environment_management","description":"Call this tool when you need access to a new category of tools. The category of tools is described as follows:\n\nThis group of tools focuses on managing Python environments within a workspace. The 'Get Python environment information for workspace' tool provides users with details about the current active environment and all available environments, which is essential for resolving environment-related issues. The 'Get current Python analysis settings and configuration for a workspace' tool allows users to review their Python analysis settings, helping to diagnose configuration problems and ensure optimal analysis performance. Finally, the 'Switch active Python environment for workspace' tool enables users to easily change their active Python environment, whether switching between different Python installations or virtual environments. Together, these tools empower users to effectively manage their Python environments, ensuring that their projects run smoothly and are configured correctly.\n\nBe sure to call this tool if you need a capability related to the above."}},{"type":"function","function":{"name":"activate_workspace_structure_and_file_management","description":"Call this tool when you need access to a new category of tools. The category of tools is described as follows:\n\nThis group of tools provides capabilities for understanding and managing the structure of a Python workspace. The 'Get workspace root directories' tool helps users identify the root directories of their workspace, which is crucial for navigating and organizing project files. The 'Get list of all user Python files in workspace' tool complements this by providing a comprehensive list of user-created Python files, excluding library and dependency files. This tool respects user-defined include/exclude settings, making it easier to analyze and operate on relevant code. Together, these tools facilitate a better understanding of the workspace layout, enabling users to efficiently manage their Python files and streamline their development process.\n\nBe sure to call this tool if you need a capability related to the above."}},{"type":"function","function":{"name":"mcp_pylance_mcp_s_pylanceDocuments","description":"Search Pylance documentation for Python language server help, configuration guidance, feature explanations, and troubleshooting. Returns comprehensive answers about Pylance settings, capabilities, and usage. Use when users ask: How to configure Pylance? What features are available? How to fix Pylance issues?","parameters":{"type":"object","properties":{"search":{"type":"string","description":"Detailed question in natural language. Think of it as a prompt for an LLM. Do not use keyword search terms."}},"required":["search"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"mcp_pylance_mcp_s_pylanceInvokeRefactoring","description":"Apply automated code refactoring to Python files. Returns refactored content (does not modify original file) unless mode is "update". Use for: extracting functions, organizing imports, improving code structure, applying refactoring patterns. Optional "mode" parameter: "update" updates the file, "edits" returns a WorkspaceEdit, "string" returns updated content as string. If mode is not specified, "update" will be used as the default. The "edits" mode is helpful for determining if a file needs changes (for example, to remove unused imports or fix import formatting) without making any modifications; if no changes are needed, the result will be either an empty WorkspaceEdit or a message indicating that no text edits were found. Available refactorings: source.unusedImports: - Removes all unused import statements from a Python file. Use when imports are imported but never referenced in the code. Requires fileUri parameter pointing to a Python file with unused imports.\nsource.convertImportFormat: - Converts import statements between absolute and relative formats according to python.analysis.importFormat setting. Use when import format consistency is needed. Requires fileUri parameter pointing to a Python file with imports to convert.\nsource.convertImportStar: - Converts all wildcard imports (from module import *) to explicit imports listing all imported symbols. Use when explicit imports are preferred for better code clarity and IDE support. Requires fileUri parameter pointing to a Python file with wildcard imports.\nsource.addTypeAnnotation: - Adds type annotations to all variables and functions in a Python file that can be inferred from their usage. Use when type hints are needed for better type checking and code clarity. Requires fileUri parameter pointing to a Python file with unannotated variables or functions.\nsource.fixAll.pylance: - Applies all available automatic code fixes from python.analysis.fixAll setting. Use when multiple code issues need to be addressed simultaneously. Requires fileUri parameter pointing to a Python file with fixable issues.","parameters":{"type":"object","properties":{"fileUri":{"type":"string","description":"The uri of the file to invoke the refactoring."},"name":{"type":"string","description":"The name of the refactoring to invoke. This must be one of these [source.unusedImports, source.convertImportFormat, source.convertImportStar, source.addTypeAnnotation, source.fixAll.pylance]"},"mode":{"type":"string","enum":["update","edits","string"],"description":"Determines the output mode: "update" updates the file directly, "edits" returns a WorkspaceEdit, "string" returns the updated content as a string. If omitted, "update" will be used as the default. The "edits" mode is especially useful for checking if any changes are needed (such as unused imports or import formatting issues) without modifying the file, as it will return a WorkspaceEdit only if edits are required."}},"required":["fileUri","name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}]
2025-12-15 09:25:23.462 [error] Unable to call the Phi-4-mini-instruct-generic-cpu:5 inference endpoint due to 500. Please check if the input or configuration is correct. 500 status code (no body)
2025-12-15 09:25:23.464 [info] Error: Microsoft.Neutron.OpenAI.Delegates.OpenAIApi [0] 2025-12-15T09:25:23.459385+03:00 Invalid Open AI JSON requested error: [Provided tools are not defined using an OpenAI-compatible tool definition format per tool. Each provided tool should use the same tool definition format., at Microsoft.Neutron.OpenAI.ToolChoiceUtils.SetToolList(JsonChatCompletionCreateRequest, ILogger) + 0x14c
at Microsoft.Neutron.OpenAI.Delegates.OpenAIApi.d__0.MoveNext() + 0x6c8]
2025-12-15 09:25:23.464 [info] Information: Microsoft.Neutron.Telemetry.TelemetryLogger [0] 2025-12-15T09:25:23.459954+03:00 UserAgent:H/JS 5.12.2 Command:OpenAIChatCompletions Status:Failure Direct:True Time:7ms

Metadata

Metadata

Assignees

Labels

*out-of-scopePosted issue is not in scope of VS Code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions