mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
refactor: Simplify validateMCPServerName to match original ternary style
This commit is contained in:
parent
8fa2734830
commit
1d67476ed0
1 changed files with 3 additions and 11 deletions
|
|
@ -47,15 +47,7 @@ export const validateMCPServerUrl = (value: string) => {
|
|||
};
|
||||
|
||||
export const validateMCPServerName = (value: string) => {
|
||||
if (!value) return Promise.resolve();
|
||||
|
||||
if (value.includes("-")) {
|
||||
return Promise.reject("Server name cannot contain '-' (hyphen). Please use '_' (underscore) instead.");
|
||||
}
|
||||
|
||||
if (value.includes(" ")) {
|
||||
return Promise.reject("Server name cannot contain spaces. Please use '_' (underscore) instead.");
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
return value && (value.includes("-") || value.includes(" "))
|
||||
? Promise.reject("Server name cannot contain '-' (hyphen) or spaces. Please use '_' (underscore) instead.")
|
||||
: Promise.resolve();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue