-
Notifications
You must be signed in to change notification settings - Fork 546
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
While data model properties within tools arguments allow DataAnnotations which are reflected in json schema, annotations on tools arguments are ignored.
To Reproduce
Steps to reproduce the behavior:
- add McpServerTool with and without annotated parameter
mcp server tool
[McpServerToolType]
public sealed class TestTool
{
[McpServerTool]
public string Echo1([MinLength(3), RegularExpression(@"[a-z]*")] string input) => input;
[McpServerTool]
public string Echo2(Message input) => input.value;
}
public readonly record struct Message([property: MinLength(3), RegularExpression(@"[a-z]*")] string value);json schema returned by tools/list
{
"tools": [
{
"name": "echo2",
"description": "",
"inputSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"value": {
"type": "string",
"pattern": "[a-z]*",
"minLength": 3
}
}
}
},
"required": [
"input"
]
}
},
{
"name": "echo1",
"description": "",
"inputSchema": {
"type": "object",
"properties": {
"input": {
"type": "string"
}
},
"required": [
"input"
]
}
}
]
}Expected behavior
Data annotations on tools arguments should be applied the same way they are on the rest of the data model.
Logs
none
Additional context
n/a
PederHP
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working