-
Notifications
You must be signed in to change notification settings - Fork 99
fix: return success from module work item add tool #125
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
Open
OshriFatkiev
wants to merge
1
commit into
makeplane:main
Choose a base branch
from
OshriFatkiev:fix/module-work-items-response
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| """Tests for module tools.""" | ||
|
|
||
| import asyncio | ||
|
|
||
| from fastmcp import Client, FastMCP | ||
|
|
||
| from plane_mcp.tools import modules as module_tools | ||
|
|
||
|
|
||
| class FakeModulesClient: | ||
| def __init__(self) -> None: | ||
| self.add_work_items_calls: list[dict[str, object]] = [] | ||
|
|
||
| def add_work_items( | ||
| self, | ||
| workspace_slug: str, | ||
| project_id: str, | ||
| module_id: str, | ||
| issue_ids: list[str], | ||
| ) -> list[dict[str, str]]: | ||
| self.add_work_items_calls.append( | ||
| { | ||
| "workspace_slug": workspace_slug, | ||
| "project_id": project_id, | ||
| "module_id": module_id, | ||
| "issue_ids": issue_ids, | ||
| } | ||
| ) | ||
| return [{"id": "module-issue-id", "module": module_id, "issue": issue_ids[0]}] | ||
|
|
||
|
|
||
| class FakePlaneClient: | ||
| def __init__(self) -> None: | ||
| self.modules = FakeModulesClient() | ||
|
|
||
|
|
||
| def test_add_work_items_to_module_returns_success_payload(monkeypatch) -> None: | ||
| """A successful SDK list response should not leak into MCP response validation.""" | ||
| fake_client = FakePlaneClient() | ||
| monkeypatch.setattr( | ||
| module_tools, | ||
| "get_plane_client_context", | ||
| lambda: (fake_client, "test-workspace"), | ||
| ) | ||
|
|
||
| async def call_tool() -> object: | ||
| mcp = FastMCP("test") | ||
| module_tools.register_module_tools(mcp) | ||
|
|
||
| async with Client(mcp) as client: | ||
| result = await client.call_tool( | ||
| "add_work_items_to_module", | ||
| { | ||
| "project_id": "project-id", | ||
| "module_id": "module-id", | ||
| "work_item_ids": ["work-item-id"], | ||
| }, | ||
| ) | ||
| return result.structured_content | ||
|
|
||
| assert asyncio.run(call_tool()) == {"success": True} | ||
| assert fake_client.modules.add_work_items_calls == [ | ||
| { | ||
| "workspace_slug": "test-workspace", | ||
| "project_id": "project-id", | ||
| "module_id": "module-id", | ||
| "issue_ids": ["work-item-id"], | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 3515
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 1430
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 1086
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 230
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 1036
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 111
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 371
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 1643
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 258
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 252
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 1439
🏁 Script executed:
Repository: makeplane/plane-mcp-server
Length of output: 3074
Replace custom TypedDict return type with a plane-sdk Pydantic model or None.
The coding guideline requires "Tool functions must return Pydantic models from plane-sdk", but
AddWorkItemsToModuleResultis a locally-definedTypedDict(line 20). The underlyingclient.modules.add_work_items()call does not return data—it's a side-effect operation. Either returnNone(consistent with similar methods incycles.pyandmilestones.py), or if structured output is needed, use an appropriate Pydantic model from theplane.modelspackage rather than a custom TypedDict.🤖 Prompt for AI Agents