diff --git a/src/MCP-Tests/MCPToolMethodSearchTest.class.st b/src/MCP-Tests/MCPToolMethodSearchTest.class.st index 5bd2829..9f295ce 100644 --- a/src/MCP-Tests/MCPToolMethodSearchTest.class.st +++ b/src/MCP-Tests/MCPToolMethodSearchTest.class.st @@ -32,18 +32,6 @@ MCPToolMethodSearchTest >> targetClassName [ ^ 'MCPToolMethodSearchTestTarget' ] -{ #category : 'tests' } -MCPToolMethodSearchTest >> testBasicRegexMatcherRemainsAvailableAsFallback [ - - | matcher tool | - tool := MCPToolSearchMethodMetadata new. - matcher := tool - basicRegexMatcherForPattern: 'MCP.*Test' - caseSensitive: true. - self assert: (matcher value: 'MCPToolMethodSearchTest'). - self deny: (matcher value: 'mcpToolMethodSearchTest') -] - { #category : 'tests' } MCPToolMethodSearchTest >> testCanFilterAcrossExplicitProtocolTarget [ @@ -704,6 +692,16 @@ MCPToolMethodSearchTest >> testParentClassNamesReturnParentMethods [ in: (data at: #methods) ] +{ #category : 'tests' } +MCPToolMethodSearchTest >> testRegexMatcherUsesBasicRegexWhenPCRE2Unavailable [ + + | matcher tool | + tool := MCPToolSearchWithoutPCRE2TestStub new. + matcher := tool regexMatcherForPattern: 'MCP.*Test' caseSensitive: true. + self assert: (matcher value: 'MCPToolMethodSearchTest'). + self deny: (matcher value: 'mcpToolMethodSearchTest') +] + { #category : 'tests' } MCPToolMethodSearchTest >> testRegexMatcherUsesPCRE2WhenLibraryAvailable [ diff --git a/src/MCP-Tests/MCPToolSearchWithoutPCRE2TestStub.class.st b/src/MCP-Tests/MCPToolSearchWithoutPCRE2TestStub.class.st new file mode 100644 index 0000000..52dbdb7 --- /dev/null +++ b/src/MCP-Tests/MCPToolSearchWithoutPCRE2TestStub.class.st @@ -0,0 +1,22 @@ +" +Test tool that models an unavailable native PCRE2 library. +" +Class { + #name : 'MCPToolSearchWithoutPCRE2TestStub', + #superclass : 'MCPToolSearchMethodMetadata', + #category : 'MCP-Tests-Support', + #package : 'MCP-Tests', + #tag : 'Support' +} + +{ #category : 'testing' } +MCPToolSearchWithoutPCRE2TestStub class >> isAbstract [ + + ^ true +] + +{ #category : 'testing' } +MCPToolSearchWithoutPCRE2TestStub >> pcre2RegexLibraryAvailable [ + + ^ false +] diff --git a/src/MCP/MCPToolSearch.class.st b/src/MCP/MCPToolSearch.class.st index ce0680e..5a936a3 100644 --- a/src/MCP/MCPToolSearch.class.st +++ b/src/MCP/MCPToolSearch.class.st @@ -296,8 +296,7 @@ MCPToolSearch >> includeSourceSchemaPropertyWithDescription: includeSourceDescri { #category : 'private - results' } MCPToolSearch >> isRegexSyntaxError: anError [ - ^ anError class = RegexSyntaxError or: [ - anError class = PCRE2CompileError ] + ^ anError class = RegexSyntaxError or: [ anError class = PCRE2CompileError ] ] { #category : 'private - template' } @@ -437,11 +436,7 @@ MCPToolSearch >> parsedRequestFromToolRequest: request [ MCPToolSearch >> pcre2RegexLibraryAvailable [ "PCRE2 is an optional native runtime dependency: the Smalltalk package can be loaded while the host library is missing." - ^ [ - LibPCRE2UTF8 config: PCRE2 configVersion. - true ] - on: Error - do: [ false ] + ^ LibPCRE2UTF8 isNativeLibraryAvailable ] { #category : 'private - filtering' }