codex icon indicating copy to clipboard operation
codex copied to clipboard

Notion connector exposes SQL query tool in schema, but runtime says tool not found

Open wadjj opened this issue 7 months ago • 8 comments

What version of the Codex App are you using (From “About Codex” dialog)?

26.422.30944 (2080)

What subscription do you have?

Plus

What platform is your computer?

Darwin 25.4.0 arm64 arm

What issue are you seeing?

In Codex Desktop with the Notion connector enabled, the tool discovery/schema indicates that Notion supports querying data sources with SQL via notion_query_data_sources.

The tool description says it can:

  • query Notion databases using SQLite SQL
  • use collection://... data source URLs as table names
  • run queries like SELECT * FROM "collection://..." LIMIT 10

However, when actually calling the tool, the Notion MCP backend returns:

MCP error -32602: Tool notion-query-data-sources not found

So the exposed tool schema and the registered runtime MCP tool set appear inconsistent.

What steps can reproduce the bug?

Uploaded thread: 019dd23a-0765-7713-a9d3-e46cc14f6c99

  1. In Codex Desktop, use the Notion connector.
  2. Search for a Notion database.
  3. Fetch the database. This returns a data source URL and a SQLite table definition, e.g. collection://35fb1d57-69a4-4d67-9bea-2d0aad2a34d2
  4. Call notion_query_data_sources with a SQL query such as:
{
  "data": {
    "mode": "sql",
    "data_source_urls": ["collection://35fb1d57-69a4-4d67-9bea-2d0aad2a34d2"],
    "query": "SELECT Status, COUNT(*) AS count FROM \"collection://35fb1d57-69a4-4d67-9bea-2d0aad2a34d2\" GROUP BY Status"
  }
}


### What is the expected behavior?

_No response_

### Additional information

_No response_

wadjj avatar Apr 28 '26 03:04 wadjj

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #19669

Powered by Codex Action

github-actions[bot] avatar Apr 28 '26 04:04 github-actions[bot]

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #19669

Powered by Codex Action

Not a duplicate, but I've found that this tool seems to require a more premium plan. Should post a clearer error message

wadjj avatar Apr 28 '26 13:04 wadjj

Hi @wadjj I have the same problem. Have you solved it?

LeonardoVolpini avatar May 17 '26 12:05 LeonardoVolpini

Additional reproduction from another Codex Desktop session, observed on 2026-05-18:

The currently exposed callable is not just the documented/logical name. Tool discovery exposes:

  • Namespace: mcp__codex_apps__notion
  • Callable: _notion_query_data_sources
  • Cached underlying/title: notion-query-data-sources

Calling the exposed callable directly still fails with the same backend error:

Error code: INVALID_ARGUMENT; Error: RuntimeException: Error calling MCP tool: [TextContent(type='text', text='MCP error -32602: Tool notion-query-data-sources not found', annotations=None, meta=None)]

The same Notion data source can be fetched successfully via the Notion fetch tool, and the fetch output includes a valid collection://... data source URL and schema. So this still looks like a runtime/tool registry mismatch rather than a database/schema/access issue.

Working fallbacks in the same session:

  • _fetch can fetch the database/data-source schema.
  • _search with data_source_url is available for search-style discovery.
  • Known pages can be fetched directly.
  • Page/property create/update paths can be used for write-compatibility checks.

Only SQL row-level data-source querying through _notion_query_data_sources appears blocked.

c10dev avatar May 18 '26 10:05 c10dev

I also have related issue with the Notion connector (plugin/apps) on notion_query_data_sources function.

Codex Version 26.602.30954

{
  "callId": "call_qzSZHVn7VAt8USIw8jJixhnb",
  "invocation": {
    "server": "codex_apps",
    "tool": "notion_notion-query-data-sources",
    "arguments": {
      "data": {
        "data_source_urls": [
          "collection://55615095-47e4-424f-b330-97902xxxxxx"
        ],
        "query": "SELECT url, \"Account Name\", \"Email (Manual Input)\" FROM \"collection://55615095-47e4-424f-b330-97902xxxxxx\" WHERE \"Email (Manual Input)\" = ? LIMIT 5",
        "params": [
          "[email protected]"
        ]
      }
    }
  },
  "durationMs": 2494,
  "result": {
    "type": "success",
    "content": [
      {
        "type": "text",
        "text": "Error code: INVALID_ARGUMENT; Error: RuntimeException: validation_error"
      }
    ],
    "structuredContent": null,
    "raw": {
      "content": [
        {
          "type": "text",
          "text": "Error code: INVALID_ARGUMENT; Error: RuntimeException: validation_error"
        }
      ],
      "structuredContent": null,
      "_meta": null
    }
  }
}

This query works if I am using Notion MCP. In Codex Notion Plugin got validation error.

andrefadila avatar Jun 05 '26 08:06 andrefadila

Hi @wadjj I have the same problem. Have you solved it?

I don't think it's solvable, notion mcp does not post a clear error message for tools that require business or enterprise plans, and codex doesn't know better.

wadjj avatar Jun 08 '26 00:06 wadjj

Same problem here.

"Tool notion-query-data-sources not found"

both on ChatGPT or Codex

The other tools seem to work fine

As codex suggested me, I've sent a bug report with /feedback Image

Feedback ID 019ebba3-b50b-7193-ab41-74b663467cc9

Fransouski avatar Jun 12 '26 12:06 Fransouski

For the GROUP BY Status example, there’s a fallback if you have an API connection with read access to the data source. Use Notion’s data-source query endpoint, follow next_cursor until has_more is false, and count the status values in the returned rows. A three-row sample with two Done and one In progress is enough to check the result. That also gives a baseline if fetching the source succeeds in Codex but the SQL tool still returns “tool not found.”

I work on Zortex. If anyone here still runs into this on a Mac, I can help try that same three-row check through our Notion connection in Codex. I’d start with a sample database and compare the counts here.

TsangKwunHei avatar Nov 20 '26 22:11 TsangKwunHei