Update MCP Server to allow for meta, structuredContent and OpenAI Apps
#95
+0
−0
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.
This PR aims to tackle a few missing pieces from the MCP Spec, specifically adding meta info to Primitive output, as well as Response output. This is only an initial take on it, if it looks like a good path forward, I'll be happy to continue to refine.
It also includes a complete way to setup the structure for a ChatGPT app, following their SDK specs.
On Primitives Meta:
A new property for
$metawas added, which will allow you to attach the_metaoutput property. Currently, this has only been applied to the Tool output, but may be added to other Primitives. This behaves in the same way that$name,$titleor$descriptionwould. A new method forsecuritySchemes()has also been added to tools, which works in a similar fashion to the JSONschema()method.Example:
On Tool Response Meta:
A few new fluent methods have been added to the
text()response type formeta()andstructuredContent(). These are then read in theCallToolmethod and returned in the response, if they're available.Example:
On OpenAI/ChatGPT Apps
A new Response method has been added called
app(), to be used in Resource primitives for returning the required data to a ChatGPT app.Example:
Tip
$appincludes some helpers for ChatGPT apps, but also includes ameta()method to allow adding additional items to the metadata responseSummary
This has handled all edge cases for me, in testing locally. The only thing I'm unsure of is if things like Prompts would ever need meta on the primitive level, or on the content level. That can be adjusted very easily, though.
On the topic of ChatGPT Apps, I've also got a fully working app setup, with a separate build process for widgets, that has worked very well, with these changes to the Laravel MCP package. I'd be happy to share it as well -- again, if this is something that looks worthy of moving forward with!
Closes #78