-
Notifications
You must be signed in to change notification settings - Fork 248
[Bug]: parent_id parameter in Confluence create_page and update_page tools not functioning as expected #389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @riteshganatra, Thank you for this detailed bug report! I've tested this in my environment and was able to successfully create and update pages using string values for This suggests that the core To help diagnose this issue, could you please provide:
This information will help us pinpoint where the validation is failing and why your string Thanks for your help! |
Hi @riteshganatra, Thank you for your detailed bug report and providing the additional information we requested. After thorough investigation, I've determined this is likely a client-side issue specific to Cursor IDE. The same functionality works correctly when tested with Claude desktop and inspector environments, and our review of the underlying MCP and FastMCP codebase confirms the implementation is correct. Since this appears to be an integration issue with Cursor IDE rather than a problem with our mcp-atlassian package, I'm going to close this issue. I recommend reaching out to the Cursor team about how their environment processes the parameter in tool calls. If you discover any new information suggesting this is actually an issue with our implementation, please feel free to reopen this ticket or create a new one with those details. Thanks for your understanding! |
let's keep opening this issue to track |
Convert Union[str, None] to str with default="" in Confluence tools to resolve client compatibility issues. Internally converts empty strings to None to maintain library behavior. Refs #389
This commit introduces a temporary workaround to improve compatibility with MCP clients, notably Cursor IDE, that may not correctly handle optional parameters defined with Union types (e.g., `str | None`) and `None` defaults, often sending empty strings, dicts, or lists instead. Changes: - Introduced a new decorator `@convert_empty_defaults_to_none` in `src/mcp_atlassian/utils/decorators.py`. This decorator intercepts tool calls and converts specific empty default values (empty strings, empty dicts, empty lists) for designated optional parameters back to `None` before the tool's main logic is executed. - Modified optional string parameters in Jira and Confluence tools (e.g., `param: str | None = None`) to `param: str = ""` in the function signature, and `Field(default="")` in `Annotated` metadata. - Modified optional dictionary parameters (e.g., `param: dict | None = None`) to `param: dict = {}` (or `Field(default_factory=dict)`) in the function signature and `Annotated` metadata. - Modified optional list parameters (e.g., `param: list[str] | None = None`) to `param: list[str] = []` (or `Field(default_factory=list)`) in the function signature and `Annotated` metadata. - Applied the `@convert_empty_defaults_to_none` decorator to all affected Jira and Confluence tool functions. - Added `# noqa: B006` to specific lines where mutable default arguments (`{}` or `[]`) are used in function signatures to satisfy Ruff, as this is a deliberate, temporary measure for client compatibility. - Included `TODO` comments highlighting that these changes are temporary and should be reverted once client-side issues are resolved. This approach ensures that the generated MCP schema presents default values (like `""`, `{}`, `[]`) that problematic clients can handle, while the internal tool logic can still expect `None` for unprovided optional parameters, maintaining cleaner business logic. Refs: Issue #389
#407) * fix: Adapt optional tool parameters for wider MCP client compatibility This commit introduces a temporary workaround to improve compatibility with MCP clients, notably Cursor IDE, that may not correctly handle optional parameters defined with Union types (e.g., `str | None`) and `None` defaults, often sending empty strings, dicts, or lists instead. Changes: - Introduced a new decorator `@convert_empty_defaults_to_none` in `src/mcp_atlassian/utils/decorators.py`. This decorator intercepts tool calls and converts specific empty default values (empty strings, empty dicts, empty lists) for designated optional parameters back to `None` before the tool's main logic is executed. - Modified optional string parameters in Jira and Confluence tools (e.g., `param: str | None = None`) to `param: str = ""` in the function signature, and `Field(default="")` in `Annotated` metadata. - Modified optional dictionary parameters (e.g., `param: dict | None = None`) to `param: dict = {}` (or `Field(default_factory=dict)`) in the function signature and `Annotated` metadata. - Modified optional list parameters (e.g., `param: list[str] | None = None`) to `param: list[str] = []` (or `Field(default_factory=list)`) in the function signature and `Annotated` metadata. - Applied the `@convert_empty_defaults_to_none` decorator to all affected Jira and Confluence tool functions. - Added `# noqa: B006` to specific lines where mutable default arguments (`{}` or `[]`) are used in function signatures to satisfy Ruff, as this is a deliberate, temporary measure for client compatibility. - Included `TODO` comments highlighting that these changes are temporary and should be reverted once client-side issues are resolved. This approach ensures that the generated MCP schema presents default values (like `""`, `{}`, `[]`) that problematic clients can handle, while the internal tool logic can still expect `None` for unprovided optional parameters, maintaining cleaner business logic. Refs: Issue #389
Hi @riteshganatra, I did the quick fix for Cursor in #407. Now this will be fine after releasing 0.10.5. Thanks for reporting! |
Prerequisites
Bug Description
1. Goal:
To create and update Confluence pages with a specified parent page, thereby establishing a hierarchical page structure using the
parent_id
parameter.2. Tools and Parameters Used:
mcp_mcp-atlassian_confluence_create_page
with theparent_id
parameter.mcp_mcp-atlassian_confluence_update_page
with theparent_id
parameter.3. Expected Behavior:
The
parent_id
parameter in bothmcp_mcp-atlassian_confluence_create_page
andmcp_mcp-atlassian_confluence_update_page
tools is defined to accept a string (page ID) orNone
(i.e.,parent_id: str | None
).The unit tests within the
sooperset/mcp-atlassian
GitHub repository (specifically intests/unit/confluence/test_pages.py
, for example,test_create_page_success
andtest_update_page_with_parent_id
) demonstrate that the underlying Python methods are designed and tested to correctly process a stringparent_id
to link to a parent page.Therefore, providing a valid string page ID to the
parent_id
parameter of these tools should result in the page being created or updated under the specified parent.4. Actual Behavior:
When a string value is provided for the
parent_id
parameter to eithermcp_mcp-atlassian_confluence_create_page
ormcp_mcp-atlassian_confluence_update_page
, the tools consistently fail with the error:Error calling tool: Parameter 'parent_id' must be of type undefined, got string
This occurred with valid parent page IDs that were confirmed to exist and could act as parents. For example, attempting to create a page with
parent_id = "2745369565"
(a valid page ID) resulted in this error.5. Supporting Observations:
mcp_mcp-atlassian_confluence_get_page_children
tool successfully retrieves child pages when provided with the same stringparent_id
. This indicates that the page IDs are valid and the Confluence instance correctly supports page hierarchies.get_page_children
.6. Suspected Cause:
The issue does not seem to be with the fundamental capability of Confluence or the validity of the page IDs. Given that the underlying Python code in
mcp-atlassian
is tested to handle stringparent_id
s, the problem likely lies at a higher level:parent_id
must beundefined
when a value is expected, conflicting with the underlying Python implementation.parent_id
before the request reaches the core Python logic of themcp-atlassian
server.Recommendation:
Review the schema definition and request validation logic for the
parent_id
parameter within themcp_mcp-atlassian_confluence_create_page
andmcp_mcp-atlassian_confluence_update_page
tools to ensure they correctly align with the underlying Python implementation's capability to accept string page IDs.Steps to Reproduce
see above
Expected Behavior
see above
Actual Behavior
mcp-atlassian Version
latest
Installation Method
Docker
Operating System
macOS
Python Version
3.11
Atlassian Instance Type
Confluence Cloud
Client Application
Cursor
Additional Context
No response
The text was updated successfully, but these errors were encountered: