-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add ResourceLink to CallToolResult #603
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
|
I would be happy to have and adopt this for VS Code 👍 |
|
I think there is a use case for returning a temporary resource that can be read via |
|
We'd be far better off including Resource as it also has the LLM Facing description. And then at the same time we could add |
|
@bhosmer-ant if in agreement we switch to Resource we should also add this to the Prompt primitive too. |
I agree I've noted this idea in #617 as well in relation to the idea of sending back resources as part of progress notifications. I think the original motivation of resource is to find long lived static resources that the server holds. However I think there are a set of use cases for short lived temporary resources associated with a specific request. This does open up the question of how long those resources are valid to avoid clogging up the server. I'm suggesting the idea of a keepAlive flag that tells the client how long it can expect the resource to be held by the server. |
@evalstate hey Shaun, yeah I think you and @jonathanhefner are totally right, Resource is better than ResourceReference here. (Going this way introduces ambiguity around whether
I'd like to leave
Yeah agreed. Actually I think it's worth factoring out and using it from both
I mean, I'll take you up on it if you agree with the above, but also happy to do it if your offer has aged out! Just LMK (and 🙏 for the discussion either way) |
|
Perfect! I'll update first thing in the morning and agree on moving the subscribable discussion elsewhere. 👍 |
schema/draft/schema.ts
Outdated
| * of the LLM and/or the user. | ||
| * | ||
| */ | ||
| export interface LinkedResource { |
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 has been added for Type Discrimination within the content block.
| export interface PromptMessage { | ||
| role: Role; | ||
| content: TextContent | ImageContent | AudioContent | EmbeddedResource; | ||
| content: ContentBlock; |
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 would be a good time to merge turns this in to an Array similar to the existing ToolCallResult.
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.
Took a quick look at that discussion, seems well motivated to me but I think best to keep it a separate PR
|
lgtm 🙂 |
0096774 to
383772c
Compare
schema/draft/schema.ts
Outdated
| | LinkedResource | ||
| | EmbeddedResource; |
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.
why aren't we letting CallToolResult include a Resource directly vs. introducing LinkedResource?
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.
We need the type discriminator.
dsp-ant
left a comment
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.
Thank you. Looks good to me. Some wording changes maybe.
Not sure I really like the name linked_resource compared to resource_link but I am not too fussed about it. Thoughts @ihrpr ?
| [Resources](/specification/draft/server/resources) **MAY** be linked, to provide additional context | ||
| or data, behind a URI that can be subscribed to or fetched by the client: |
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.
| [Resources](/specification/draft/server/resources) **MAY** be linked, to provide additional context | |
| or data, behind a URI that can be subscribed to or fetched by the client: | |
| A tool **MAY** return links to [Resources](/specification/draft/server/resources) **MAY**, to provide additional context | |
| or data. In this case, the tool will return a URI that can be subscribed to or fetched by the client: |
Given that we are inheriting from the But also not a strong preference, just thinking out loud |
|
@ihrpr @dsp-ant I'm also weak on the name. The "real" name is How about Followup: "content" sort of implies removing a level of indirection, so not a panacea. Going with |
ihrpr
left a comment
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.
LGTM!
I went down this path...:) We already have a |
…l Results and Prompts
…l Results and Prompts
Yeah, I also though about |
|
I ran this [naming] problem through the Claude quite a few times! |
5ab58db to
bfbd362
Compare
Enables tool calls to return
ResourceLinks (in addition to fullEmbeddedResources) in results.Motivation and Context
Returning resource links enables interaction flows where returning resource content inline is impractical.
ResourceLinkreuses theResourcestructure unchanged, but adds a necessary type tag for disambiguation inContentBlockarrays.How Has This Been Tested?
No testing yet.
Breaking Changes
Older clients will not be able to interpret the new content type.
Types of changes
Checklist
Additional context