-
Notifications
You must be signed in to change notification settings - Fork 674
fix(tools): add omitempty
to properties
#116
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
Conversation
WalkthroughThe change modifies the JSON serialization behavior for the Changes
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@jkoelker hi, in my case, when i use non params tools, My AI app (dify with mcp-agent) will report errors. This is a record of our discussion at that time (junjiem/dify-plugin-agent-mcp_sse#1 (comment)), when I deleted the |
@resurgence72 as per the spec (same for the 2024 version) only the I think that the error actually lies in the Just going off the code at https://github.com/junjiem/dify-plugin-agent-mcp_sse/blob/main/strategies/ReAct.py#L579 I think it could be handled it in a way that is more compatible with the spec: for tool in mcp_tools:
parameters = tool.get("inputSchema")
if "properties" not in parameters:
parameters["properties"] = {}
prompt_message = PromptMessageTool(
name=tool.get("name"),
description=tool.get("description", None),
parameters=parameters,
)
prompt_messages_tools.append(prompt_message) |
Thank you for your reply. I ignored schema.json before, and I think your modification is correct. I will feedback this problem to the developers of dify-mcp in the future |
When there is no input to a tool, the `Properies` map is `nil` if the Tool is not created using `NewTool`. This causes the `property` field to be set to `null` and clients such as `claude-desktop` to skip the tools silently. Annotating the field as `omitempty` is inline with the behavior of the [typescript-sdk](https://github.com/modelcontextprotocol/typescript-sdk/blob/fbdeb06a4185ba2f7581603a768cd7171c64d6fc/src/types.ts#L749).
1931cb6
to
4fceacf
Compare
rebased on main to pick up the race condition fix. |
When there is no input to a tool, the
Properies
map isnil
if the Tool is not created usingNewTool
. This causes theproperty
field to be set tonull
and clients such asclaude-desktop
to skip the tools silently.Annotating the field as
omitempty
is inline with the behavior of the typescript-sdk.Summary by CodeRabbit