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
2 changes: 1 addition & 1 deletion docs/dev/developing-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Rules:
strings, or broad exception swallowing.
- Keep schema and contract tests close to tool behavior changes.
- Keep discoverable-tool metadata current when adding or changing tool groups,
keywords, mutability, risk, or schema-inspection expectations.
keywords, standard tool annotations, or schema-inspection expectations.
- For debugger tools, keep state references opaque and scoped to the debug
state that returned them.
- Keep UI changes separate from core MCP tool behavior unless the task
Expand Down
6 changes: 6 additions & 0 deletions src/MCP-Tests/MCPHaltingTestTool.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ MCPHaltingTestTool >> executeWithRequest: aRequest [
(Smalltalk globals at: #Halt) signal: 'mcp tool halt test'
]

{ #category : 'metadata' }
MCPHaltingTestTool >> groupName [

^ 'plugins'
]

{ #category : 'metadata' }
MCPHaltingTestTool >> title [

Expand Down
3 changes: 1 addition & 2 deletions src/MCP-Tests/MCPSaveImageRecordingServer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ MCPSaveImageRecordingServer >> didSaveImageSession [
{ #category : 'private - calling' }
MCPSaveImageRecordingServer >> rpcToolCall: aToolName withParams: someArguments [

(MCPToolRegistry isStaticTool: aToolName) ifTrue: [
^ super rpcToolCall: aToolName withParams: someArguments ].
(self toolRegistry isStaticToolNamed: aToolName) ifTrue: [ ^ super rpcToolCall: aToolName withParams: someArguments ].
^ super rpcToolCall: 'tool_call' withParams: {
(#toolName -> aToolName).
(#arguments -> someArguments) } asDictionary
Expand Down
15 changes: 10 additions & 5 deletions src/MCP-Tests/MCPToolAPITestCase.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ MCPToolAPITestCase >> callRawToolNamed: aToolName withArguments: someArguments [
{ #category : 'private - calling' }
MCPToolAPITestCase >> callToolNamed: aToolName withArguments: someArguments [

(MCPToolRegistry isStaticTool: aToolName) ifTrue: [
^ self callRawToolNamed: aToolName withArguments: someArguments ].
^ self
callDiscoveredToolNamed: aToolName
withArguments: someArguments
| mcp |
mcp := self mcpWithoutObservabilityExport.
(mcp toolRegistry isStaticToolNamed: aToolName) ifTrue: [ ^ self callRawToolNamed: aToolName withArguments: someArguments ].
^ self callDiscoveredToolNamed: aToolName withArguments: someArguments
]

{ #category : 'private - results' }
Expand Down Expand Up @@ -131,6 +130,12 @@ MCPToolAPITestCase >> summaryFrom: aResult [
^ (self structuredContentFrom: aResult) at: #summary
]

{ #category : 'support' }
MCPToolAPITestCase >> toolRegistry [

^ self mcpWithoutObservabilityExport toolRegistry
]

{ #category : 'private - parsing' }
MCPToolAPITestCase >> unvalidatedToolRequestForTool: aTool arguments: someArguments [

Expand Down
24 changes: 7 additions & 17 deletions src/MCP-Tests/MCPToolChangeHistoryToolsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,19 @@ MCPToolChangeHistoryToolsTest >> inputPropertyNamesFor: aTool [
]

{ #category : 'tests' }
MCPToolChangeHistoryToolsTest >> testChangeHistoryToolsAreDiscoverableWithExpectedRisk [
MCPToolChangeHistoryToolsTest >> testChangeHistoryToolsAreDiscoverableWithExpectedMetadata [

| metadataByName result toolNames |
result := self
callToolNamed: 'tool_search'
withArguments: { (#group -> 'history') } asDictionary.
metadataByName := (((self dataFrom: result) at: #tools) collect: [ :each |
(each at: #name) -> each ]) asDictionary.
result := self callToolNamed: 'tool_search' withArguments: { (#group -> 'history') } asDictionary.
metadataByName := (((self dataFrom: result) at: #tools) collect: [ :each | (each at: #name) -> each ]) asDictionary.
toolNames := metadataByName keys.
#( 'history_file_list' 'history_entry_list' 'history_entry_apply'
'history_entry_revert' ) do: [ :toolName |
#( 'history_file_list' 'history_entry_list' 'history_entry_apply' 'history_entry_revert' ) do: [ :toolName |
| metadata tool |
self assert: (toolNames includes: toolName).
tool := MCPToolRegistry
toolNamed: toolName
ifAbsent: [ self fail: 'Missing tool ' , toolName ].
self
assert: (MCPToolRegistry exposureForTool: tool)
equals: 'discoverable'.
tool := self toolRegistry toolNamed: toolName ifAbsent: [ self fail: 'Missing tool ' , toolName ].
self assert: tool defaultExposure equals: 'discoverable'.
metadata := metadataByName at: toolName.
self
assert: metadata keys asSet
equals: #( name description ) asSet ]
self assert: metadata keys asSet equals: #( name description ) asSet ]
]

{ #category : 'tests' }
Expand Down
Loading
Loading