Skip to content

Conversation

eiriktsarpalis
Copy link
Member

Fix #342.

Copy link
Contributor

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

It does seem like having the "title" and "description" in the auto-generated JSON Schema is unexpected and redundant in the context of MCP. I don't love this way of dealing with it though. Anyone configuring their own SchemaCreateOptions no needs to know to remove the "title" and "description" properties from the root of the schema in a custom transformation to get the better behavior.

I think it would be far better to update AIJsonUtilities.CreateFunctionJsonSchema, AIJsonSchemaCreateOptions and AIFunctionFactory to let you disable top-level "title" and "description" properties in the schema. Why is it possible to override the value of these properties but not remove them without a custom transformation? If we did this, we could then update the default SchemaCreateOptions to be non-null with the MCP-specific configuration that disables the title and description.

}

[Fact]
public void TrimsDescriptionAndTitleKeywordsFromRootSchema()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a similar test for prompts?

@eiriktsarpalis
Copy link
Member Author

eiriktsarpalis commented May 20, 2025

I think it would be far better to update AIJsonUtilities.CreateFunctionJsonSchema, AIJsonSchemaCreateOptions and AIFunctionFactory to let you disable top-level "title" and "description" properties in the schema.

It's a good point, I think we might consider eliminating title and description altogether in the case of AIFunctionFactory because of the redundancy it creates. Even though MEAI is now stable, I wouldn't consider this a breaking change.

@eiriktsarpalis
Copy link
Member Author

@halter73 I've opened a second PR in dotnet/extensions#6465 that applies your suggestion. Will keep this one open until we decide which way to go.

@eiriktsarpalis
Copy link
Member Author

Superseded by dotnet/extensions#6465

@eiriktsarpalis eiriktsarpalis deleted the trim-root-level-schema-keywords branch May 20, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

McpServer builder extensions result in Tool InputSchema which isn't spec compliant

2 participants