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
16 changes: 15 additions & 1 deletion src/MCP-Tests/MCPToolAPITestCase.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ MCPToolAPITestCase >> callToolNamed: aToolName withArguments: someArguments [
{ #category : 'private - results' }
MCPToolAPITestCase >> dataFrom: aResult [

^ (self structuredContentFrom: aResult) at: #data
| structuredContent |
structuredContent := self structuredContentFrom: aResult.
self
deny: (self resultIndicatesError: aResult)
description: (self summaryFrom: aResult).
^ structuredContent at: #data
]

{ #category : 'private - results' }
Expand Down Expand Up @@ -99,6 +104,15 @@ MCPToolAPITestCase >> parsedRequestForTool: aTool arguments: someArguments [
arguments: someArguments)
]

{ #category : 'private - results' }
MCPToolAPITestCase >> resultIndicatesError: aResult [

| structuredContent |
structuredContent := self structuredContentFrom: aResult.
^ (structuredContent at: #isError ifAbsent: [ false ]) or: [
(structuredContent at: #status ifAbsent: [ 'ok' ]) = 'error' ]
]

{ #category : 'support' }
MCPToolAPITestCase >> searchScope: scopeAssociations [

Expand Down
20 changes: 13 additions & 7 deletions src/MCP-Tests/MCPToolChangeHistoryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,24 @@ MCPToolChangeHistoryTest >> testListEntriesSupportsHistoryFileName [

| data entries file files filesResult result |
filesResult := self callToolWith:
{ (#action -> 'listFiles') } asDictionary.
{ (#action -> 'listFiles') } asDictionary.
data := self dataFrom: filesResult.
files := data at: #files.
file := files detect: [ :each |
each at: #isCurrent ifAbsent: [ false ] ].
file := files
detect: [ :each |
(each at: #isCurrent ifAbsent: [ false ]) and: [
(each at: #exists ifAbsent: [ true ]) ~= false ] ]
ifNone: [
files
detect: [ :each |
(each at: #exists ifAbsent: [ true ]) ~= false ]
ifNone: [ self skip: 'No existing change history file.' ] ].
result := self callToolWith: {
(#action -> 'listEntries').
(#historyFileName -> (file at: #fileName)).
(#limit -> 1) } asDictionary.
(#action -> 'listEntries').
(#historyFileName -> (file at: #fileName)).
(#limit -> 1) } asDictionary.
data := self dataFrom: result.
entries := data at: #entries.
self deny: (result at: #isError ifAbsent: [ false ]).
self assert: (data at: #historyFileName) equals: (file at: #fileName).
self assert: entries size <= 1
]
Expand Down
Loading
Loading