Skip to content

Conversation

iBotPeaches
Copy link
Collaborator

@iBotPeaches iBotPeaches commented Aug 22, 2025

What:

  • Bug Fix
  • New Feature

Description:

Adds support for MCP Connectors (Official MCP Servers). While on that journey I kept having crashes due to the error property swapping between 3 things (null, string or a json-array). So I've added support for that as well by turning the Response API exception class to be generic for any endpoint to leverage.

Related:

fixes: #653 (connector), closes: #619 (error mcp handling)

@iBotPeaches
Copy link
Collaborator Author

  +tools: array:1 [
    0 => OpenAI\Responses\Responses\Tool\RemoteMcpTool {#675
      +type: "mcp"
      +serverLabel: "Dropbox"
      +serverUrl: null
      +requireApproval: "never"
      +allowedTools: null
      +headers: null
      +connectorId: "connector_dropbox"
      +authorization: "<redacted>"
      +serverDescription: null
    }
  ]

Connector Sample

    }
    4 => OpenAI\Responses\Responses\Output\OutputMcpCall {#671
      +id: "mcp_68a84a9e844081a18af27a47357e2a4c0a287a153dc5fdbd"
      +serverLabel: "Dropbox"
      +type: "mcp_call"
      +arguments: "{}"
      +name: "get_profile"
      +approvalRequestId: null
      +error: "{"type":"http_error","code":401,"message":"An unknown error occurred while executing the tool."}"
      +output: null
    }

Error sample - appears to just return a regular structured OpenAI error

@iBotPeaches
Copy link
Collaborator Author

{
    "id": "resp_68a9a190f694819f83fab13668831b990dc2c249e6fcf322",
    "object": "response",
    "created_at": 1755947409,
    "status": "completed",
    "background": false,
    "error": null,
    "incomplete_details": null,
    "instructions": null,
    "max_output_tokens": null,
    "max_tool_calls": null,
    "model": "gpt-5-2025-08-07",
    "output": [
        {
            "id": "mcpl_68a9a19112dc819f8b4e923b4641db250dc2c249e6fcf322",
            "type": "mcp_list_tools",
            "server_label": "Dropbox",
            "tools": [
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Fetches a file by path.If `download_raw_file` is set to True, the file will be downloaded as a raw file. Otherwise, the file will be displayed as text.",
                    "input_schema": {
                        "properties": {
                            "path": {
                                "title": "Path",
                                "type": "string"
                            },
                            "download_raw_file": {
                                "default": false,
                                "title": "Download Raw File",
                                "type": "boolean"
                            }
                        },
                        "required": [
                            "path"
                        ],
                        "title": "fetch_input",
                        "type": "object"
                    },
                    "name": "fetch"
                },
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Fetch a file from Dropbox given its path. If `download_raw_file` is set to True, the file will be downloaded as a raw file. Otherwise, the file will be displayed as text.",
                    "input_schema": {
                        "properties": {
                            "path": {
                                "title": "Path",
                                "type": "string"
                            },
                            "download_raw_file": {
                                "default": false,
                                "title": "Download Raw File",
                                "type": "boolean"
                            }
                        },
                        "required": [
                            "path"
                        ],
                        "title": "fetch_file_input",
                        "type": "object"
                    },
                    "name": "fetch_file"
                },
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Retrieve the Dropbox profile for the current user.",
                    "input_schema": {
                        "properties": {},
                        "title": "get_profile_input",
                        "type": "object"
                    },
                    "name": "get_profile"
                },
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Return the most recently modified files accessible to the user.",
                    "input_schema": {
                        "properties": {
                            "topk": {
                                "title": "Topk",
                                "type": "integer"
                            }
                        },
                        "required": [
                            "topk"
                        ],
                        "title": "list_recent_files_input",
                        "type": "object"
                    },
                    "name": "list_recent_files"
                },
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Searches Dropbox for files matching a query.        Queries work best with short filenames        or concise phrases such as ``\"budget.csv\"`` or ``\"Q1 meeting notes\"``.        ``recency_days`` is currently ignored.",
                    "input_schema": {
                        "properties": {
                            "query": {
                                "title": "Query",
                                "type": "string"
                            },
                            "topn": {
                                "default": 5,
                                "title": "Topn",
                                "type": "integer"
                            },
                            "recency_days": {
                                "anyOf": [
                                    {
                                        "type": "integer"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "default": null,
                                "title": "Recency Days"
                            }
                        },
                        "required": [
                            "query"
                        ],
                        "title": "search_input",
                        "type": "object"
                    },
                    "name": "search"
                },
                {
                    "annotations": {
                        "read_only": true
                    },
                    "description": "Search Dropbox files and return matching results.        Queries work best with short filenames        or concise phrases such as ``\"budget.csv\"`` or ``\"Q1 meeting notes\"``.        ``recency_days`` is currently ignored.",
                    "input_schema": {
                        "properties": {
                            "query": {
                                "title": "Query",
                                "type": "string"
                            },
                            "topn": {
                                "default": 5,
                                "title": "Topn",
                                "type": "integer"
                            },
                            "recency_days": {
                                "anyOf": [
                                    {
                                        "type": "integer"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "default": null,
                                "title": "Recency Days"
                            },
                            "filter_file_extensions": {
                                "anyOf": [
                                    {
                                        "items": {
                                            "type": "string"
                                        },
                                        "type": "array"
                                    },
                                    {
                                        "type": "null"
                                    }
                                ],
                                "default": null,
                                "title": "Filter File Extensions"
                            }
                        },
                        "required": [
                            "query"
                        ],
                        "title": "search_files_input",
                        "type": "object"
                    },
                    "name": "search_files"
                }
            ]
        },
        {
            "id": "rs_68a9a191b888819fbeda4509cceca3920dc2c249e6fcf322",
            "type": "reasoning",
            "summary": []
        },
        {
            "id": "mcp_68a9a196db04819f86810859684ab11a0dc2c249e6fcf322",
            "type": "mcp_call",
            "approval_request_id": null,
            "arguments": "{\"topk\":50}",
            "error": {
                "type": "http_error",
                "code": 401,
                "message": "An unknown error occurred while executing the tool."
            },
            "name": "list_recent_files",
            "output": null,
            "server_label": "Dropbox"
        },
        {
            "id": "rs_68a9a19767f0819f83461056d88646f40dc2c249e6fcf322",
            "type": "reasoning",
            "summary": []
        },
        {
            "id": "mcp_68a9a198dc38819f833426f045d82ee40dc2c249e6fcf322",
            "type": "mcp_call",
            "approval_request_id": null,
            "arguments": "{\"query\":\"draft\",\"topn\":25,\"recency_days\":null,\"filter_file_extensions\":[\"pptx\",\"ppt\",\"key\",\"odp\",\"pdf\"]}",
            "error": {
                "type": "http_error",
                "code": 401,
                "message": "An unknown error occurred while executing the tool."
            },
            "name": "search_files",
            "output": null,
            "server_label": "Dropbox"
        },
        {
            "id": "rs_68a9a199760c819fbee7cd33dfb77f120dc2c249e6fcf322",
            "type": "reasoning",
            "summary": []
        },
        {
            "id": "msg_68a9a19c8344819f97fa1e911ee70bec0dc2c249e6fcf322",
            "type": "message",
            "status": "completed",
            "content": [
                {
                    "type": "output_text",
                    "annotations": [],
                    "logprobs": [],
                    "text": "I tried to check your Dropbox for slide decks but couldn\u2019t access it due to an authorization error. If you connect Dropbox, I can scan for in\u2011progress decks (e.g., recent .pptx/.key/.odp files with names like \u201cdraft,\u201d \u201cWIP,\u201d \u201cv0,\u201d etc., or in folders like Drafts/In Progress) and list them.Would you like me to try again after reconnecting Dropbox, or should I look in another location (Google Drive, OneDrive, local)? If you prefer to search manually, filter for:- File types: pptx, ppt, key, odp- Name keywords: draft, wip, in progress, v0, v1, review, temp- Modified in the last 60\u201390 daysTell me where to look and I\u2019ll pull the list."
                }
            ],
            "role": "assistant"
        }
    ],
    "parallel_tool_calls": true,
    "previous_response_id": null,
    "prompt_cache_key": null,
    "reasoning": {
        "effort": "medium",
        "summary": null
    },
    "safety_identifier": null,
    "service_tier": "auto",
    "store": true,
    "temperature": 1.0,
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "tool_choice": "auto",
    "tools": [
        {
            "type": "mcp",
            "allowed_tools": null,
            "authorization": "<redacted>",
            "connector_id": "connector_dropbox",
            "headers": null,
            "require_approval": "never",
            "server_description": null,
            "server_label": "Dropbox",
            "server_url": null
        }
    ],
    "top_logprobs": 0,
    "top_p": 1.0,
    "truncation": "disabled",
    "usage": {
        "input_tokens": 2764,
        "input_tokens_details": {
            "cached_tokens": 1280
        },
        "output_tokens": 956,
        "output_tokens_details": {
            "reasoning_tokens": 704
        },
        "total_tokens": 3720
    },
    "user": null,
    "metadata": {}
}

Full raw sample of Dropbox (no auth) Connector

@iBotPeaches iBotPeaches changed the title DRAFT - fix(OpenAI): augment support for Response API - MCP Connectors fix(OpenAI): augment support for Response API - MCP Connectors Aug 23, 2025
@iBotPeaches iBotPeaches marked this pull request as ready for review August 23, 2025 11:31
@iBotPeaches iBotPeaches added this to the v0.16.0 milestone Aug 23, 2025
@iBotPeaches iBotPeaches merged commit 049f417 into main Aug 23, 2025
24 checks passed
@iBotPeaches iBotPeaches deleted the mcp-connector-support branch August 25, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add New MCP Connectors support
1 participant