Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changesets/feat_output_schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Add outputSchema support - @DaleSeo PR #509

This PR implements support for the MCP specification's [outputSchema](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#output-schema) field on tools, which allows tools to declare the expected structure of their output. This helps LLMs better understand and reason about GraphQL response data.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please include the part about needing to opt into it and include a config example? :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! Updated the changeset.


This feature is opt-in to avoid additional token overhead. To enable it, add the following to your config:

```yaml
overrides:
enable_output_schema: true
```
9 changes: 9 additions & 0 deletions crates/apollo-mcp-server/src/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub(crate) fn load_from_path(
mutation_mode: MutationMode,
disable_type_description: bool,
disable_schema_description: bool,
enable_output_schema: bool,
) -> Result<Vec<App>, String> {
let Ok(apps_dir) = path.read_dir() else {
return Ok(Vec::new());
Expand Down Expand Up @@ -146,6 +147,7 @@ pub(crate) fn load_from_path(
mutation_mode,
disable_type_description,
disable_schema_description,
enable_output_schema,
) {
Err(err) => {
return Err(format!(
Expand Down Expand Up @@ -393,6 +395,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
)
.expect("Failed to load apps");
assert_eq!(apps.len(), 1);
Expand Down Expand Up @@ -428,6 +431,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
)
.expect("Failed to load apps");
assert_eq!(apps.len(), 1);
Expand Down Expand Up @@ -477,6 +481,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
)
.expect("Failed to load apps");
assert_eq!(apps.len(), 1);
Expand Down Expand Up @@ -536,6 +541,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
)
.expect("Failed to load apps");
assert_eq!(apps.len(), 1);
Expand Down Expand Up @@ -592,6 +598,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
)
.expect("Failed to load apps");

Expand Down Expand Up @@ -655,6 +662,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
);

assert!(apps.is_err());
Expand Down Expand Up @@ -701,6 +709,7 @@ mod test_load_from_path {
MutationMode::All,
false,
false,
true,
);

assert!(apps.is_err());
Expand Down
12 changes: 6 additions & 6 deletions crates/apollo-mcp-server/src/apps/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ mod tests {
"query Primary($apples: Int) { apples(first: $apples) }".to_string(),
None,
))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap(),
);
Expand All @@ -174,7 +174,7 @@ mod tests {
"query FirstPrefetch($bananas: Int) { bananas(first: $bananas) }".to_string(),
None,
))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap(),
);
Expand All @@ -183,7 +183,7 @@ mod tests {
"query SecondPrefetch($oranges: Int) { oranges(first: $oranges) }".to_string(),
None,
))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap(),
);
Expand Down Expand Up @@ -314,7 +314,7 @@ mod tests {
tools: vec![AppTool {
operation: Arc::new(
RawOperation::from(("query GetId { id }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, false, false)
.into_operation(&schema, None, MutationMode::All, false, false, true)
.unwrap()
.unwrap(),
),
Expand Down Expand Up @@ -361,7 +361,7 @@ mod tests {
tools: vec![AppTool {
operation: Arc::new(
RawOperation::from(("query GetId { id }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, false, false)
.into_operation(&schema, None, MutationMode::All, false, false, true)
.unwrap()
.unwrap(),
),
Expand Down Expand Up @@ -400,7 +400,7 @@ mod tests {
tools: vec![AppTool {
operation: Arc::new(
RawOperation::from(("query GetId { id }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, false, false)
.into_operation(&schema, None, MutationMode::All, false, false, true)
.unwrap()
.unwrap(),
),
Expand Down
1 change: 1 addition & 0 deletions crates/apollo-mcp-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ async fn main() -> anyhow::Result<()> {
.mutation_mode(config.overrides.mutation_mode)
.disable_type_description(config.overrides.disable_type_description)
.disable_schema_description(config.overrides.disable_schema_description)
.enable_output_schema(config.overrides.enable_output_schema)
.disable_auth_token_passthrough(match transport {
apollo_mcp_server::server::Transport::Stdio => false,
apollo_mcp_server::server::Transport::SSE { auth, .. } => auth
Expand Down
6 changes: 3 additions & 3 deletions crates/apollo-mcp-server/src/operations/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod tests {
.validate()
.unwrap();
let operation = RawOperation::from(("query GetHello { hello }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap();

Expand All @@ -78,11 +78,11 @@ mod tests {
.unwrap();
let operations = [
RawOperation::from(("query GetHello { hello }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap(),
RawOperation::from(("query GetWorld { hello }".to_string(), None))
.into_operation(&schema, None, MutationMode::All, true, true)
.into_operation(&schema, None, MutationMode::All, true, true, true)
.unwrap()
.unwrap(),
];
Expand Down
Loading