Fix errors when title is not specified
Since the optional `title` becomes `title: null` when not provided, the following error occurs.
This occurs with Claude Code 1.0.100.
```console
[DEBUG] MCP server "example": Connection failed after 1591ms: [
{
"code": "invalid_type",
"expected": "string",
"received": "null",
"path": [
"serverInfo",
"title"
],
"message": "Expected string, received null"
}
]
```
By adding `compact`, the `title` key will be removed if the optional `title` keyword argument is not specified.
This commit is contained in:
parent
eb0d9c0e6d
commit
47d29e8014
2 changed files with 12 additions and 4 deletions
|
|
@ -222,7 +222,7 @@ module MCP
|
|||
name:,
|
||||
title:,
|
||||
version:,
|
||||
}
|
||||
}.compact
|
||||
end
|
||||
|
||||
def init(request)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module MCP
|
|||
title: title_value,
|
||||
description: description_value,
|
||||
inputSchema: input_schema_value.to_h,
|
||||
}
|
||||
}.compact
|
||||
result[:annotations] = annotations_value.to_h if annotations_value
|
||||
result
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue