@@ -131,20 +131,10 @@ public function fromMethodParameters(ReflectionMethod $method): array
131131 }
132132 }
133133
134- // Add format for specific string types (basic inference)
135- if (isset ($ paramSchema ['type ' ])) {
136- $ schemaType = is_array ($ paramSchema ['type ' ]) ? (in_array ('string ' , $ paramSchema ['type ' ]) ? 'string ' : null ) : $ paramSchema ['type ' ];
137- if ($ schemaType === 'string ' ) {
138- if (stripos ($ name , 'email ' ) !== false || stripos ($ typeString , 'email ' ) !== false ) {
139- $ paramSchema ['format ' ] = 'email ' ;
140- } elseif (stripos ($ name , 'date ' ) !== false || stripos ($ typeString , 'date ' ) !== false ) {
141- $ paramSchema ['format ' ] = 'date-time ' ; // Or 'date' depending on convention
142- } elseif (stripos ($ name , 'uri ' ) !== false || stripos ($ name , 'url ' ) !== false || stripos ($ typeString , 'uri ' ) !== false || stripos ($ typeString , 'url ' ) !== false ) {
143- $ paramSchema ['format ' ] = 'uri ' ;
144- }
145- // Add more format detections if needed
146- }
147- }
134+ // TODO: Revisit format inference or add explicit @schema docblock tag for formats in a future version.
135+ // For now, parameters typed as 'string' will not have a 'format' keyword automatically added.
136+ // Users needing specific string format validation (date-time, email, uri, regex pattern)
137+ // would need to perform that validation within their tool/resource handler method.
148138
149139 // Handle array items type if possible
150140 if (isset ($ paramSchema ['type ' ])) {
@@ -176,7 +166,7 @@ public function fromMethodParameters(ReflectionMethod $method): array
176166
177167 if (empty ($ schema ['properties ' ])) {
178168 // Keep properties object even if empty, per spec
179- $ schema ['properties ' ] = new stdClass () ;
169+ $ schema ['properties ' ] = new stdClass ;
180170 }
181171 if (empty ($ schema ['required ' ])) {
182172 unset($ schema ['required ' ]);
0 commit comments