Notion MCP Integration: “Expected object, received string” Error with Nested Parameters
I’m experiencing a consistent issue with the Notion MCP (Model Context Protocol) integration where nested object parameters are being incorrectly parsed as strings, causing all operations that require complex parent or data objects to fail.
Environment
-
Integration: Notion MCP Server
-
Client: Claude with MCP integration
-
Issue: Parameter serialization/parsing bug with nested objects
Problem Description
When attempting to use Notion MCP functions that require nested object parameters, I consistently get validation errors indicating that objects are being received as strings.
Error Examples
1. Creating Pages in Database
Code:
{
"pages": [
{
"properties": {
"Name": "Test Item",
"Status": "Not started",
"Sub Group": "Ben"
}
}
],
"parent": {
"database_id": "15ee8129-6c2b-8010-ae07-c6b7bddd3c66",
"type": "database_id"
}
}
Error:
MCP error -32602: Invalid arguments for tool create-pages: [
{
"code": "invalid_union",
"unionErrors": [
{
"issues": [
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": ["parent"],
"message": "Expected object, received string"
}
],
"name": "ZodError"
}
],
"path": ["parent"],
"message": "Invalid input"
}
]
2. Moving Pages
Code:
{
"page_or_database_ids": ["225e8129-6c2b-81f9-a6a6-ee10d9486331"],
"new_parent": {
"database_id": "15ee8129-6c2b-8010-ae07-c6b7bddd3c66",
"type": "database_id"
}
}
Error:
MCP error -32602: Invalid arguments for tool move-pages: [
{
"code": "invalid_union",
"unionErrors": [
{
"issues": [
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": ["new_parent"],
"message": "Expected object, received string"
}
]
}
]
}
]
3. Updating Page Properties
Code:
{
"data": {
"page_id": "225e8129-6c2b-81f9-a6a6-ee10d9486331",
"command": "update_properties",
"properties": {
"Name": "Updated Name",
"Status": "Not started"
}
}
}
Error:
MCP error -32602: Invalid arguments for tool update-page: [
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": ["data"],
"message": "Expected object, received string"
}
]
What Works
Simple operations without nested objects work fine:
// This works ✅
{
"pages": [
{
"properties": {
"title": "Simple Page"
}
}
]
// No parent parameter
}
What I’ve Tried
-
Different parameter formats: Tried various object structures and property names
-
Different database IDs: Used both page ID and collection ID formats
-
Simplified objects: Reduced nested objects to minimum required fields
-
Alternative functions: Same issue occurs across multiple MCP functions
Analysis
The issue appears to be in the parameter serialization layer where:
-
Simple parameters (strings, arrays) are passed correctly
-
Nested objects are being stringified somewhere in the MCP pipeline
-
The Zod schema validation then fails because it receives a string instead of an object
Questions
-
Is this a known issue with the Notion MCP integration?
-
Are there workarounds for creating pages directly in databases?
-
Is there a different parameter format that works for nested objects?
-
Are there alternative approaches to achieve the same functionality?
Expected Behavior
The parent and data parameters should be passed as objects to the Notion API, allowing for proper database operations as documented in the Notion API specification.
Additional Context
-
Authentication works fine (can fetch pages, search, etc.)
-
Read operations work perfectly
-
Issue only affects write operations with nested parameters
-
Same database operations work fine via direct Notion API calls
Any insights or workarounds would be greatly appreciated!
Tags: notion-api, mcp, model-context-protocol, javascript, integration, parameter-serialization