Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/MCP-Tests/MCPToolMethodSearchTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down Expand Up @@ -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 [

Expand Down
22 changes: 22 additions & 0 deletions src/MCP-Tests/MCPToolSearchWithoutPCRE2TestStub.class.st
Original file line number Diff line number Diff line change
@@ -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
]
9 changes: 2 additions & 7 deletions src/MCP/MCPToolSearch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down Expand Up @@ -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' }
Expand Down
Loading