-
Notifications
You must be signed in to change notification settings - Fork 882
Make ResourceTemplate list callback optional #566
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
kentcdodds
wants to merge
1
commit into
modelcontextprotocol:main
Choose a base branch
from
kentcdodds:patch-1
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.
+3
−3
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
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.
this is interesting, i need to read the code more to grok what's going, but i see that
foo: bar | undefined
is frequently preferred over the usualfoo?: bar
here, and I suspect it's intentional, and my current guess is it has to do withzodToJsonSchema
, where this is a distinction with a difference, apparently, because in the generated JSONSchema,list
will be included in"required"
if you use thebar | undefined
syntax, whereas it will not be required with thefoo?:
syntax... I don't know how all these pieces fit together, and my interpretation does not comport well with the the comment about forgetting things, but my suspicion is there is (or was thought to be) a good reason for this. So far I haven't found how JSONSchema is used in this repo, maybe there is validation againstschema.ts
to check compliance(?). Obviously someone more directly involved in writing this should probably weigh in but without further context about the issues discussed above, I don't think it's so simple.Uh oh!
There was an error while loading. Please reload this page.
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.
Basically, the way it is currently, you have to include the callback object with a list property even if you can't list your resources and you must set it to undefined.
@jspahrsummers was the original author of this code, and no explanation was given other than the comment in the code. I do not think other SDKs have this same requirement. But in any case, I don't think supplying an undefined callback should be required.
Uh oh!
There was an error while loading. Please reload this page.
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.
Right, so from what I gleaned, this makes a difference if you use something like zodToJsonSchema, because it means the schema will put "list" in the "required" properties array (even if the value is
undefined
, which I'm not sure if that's recommended anyway). But, either way, you can see this style repeated in the file, so it appears deliberate to me, so I'll just defer to someone who's more intimate with the codebase. But in any case, I hope you see my point, I just don't know how zodToJsonSchema is being leveraged in this repo.EDIT: If I had to speculate (which I don't), I'd guess it might enable you to generate a JSONSchema and then validate it against the protocol's JSONSchema...