@evref-bl/pharo-mcp 1.5.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,19 +5,31 @@ advertised directly; less common tools can be found through the catalog tools.
5
5
  Tool names use `snake_case` names that generally put the domain before the
6
6
  action.
7
7
 
8
- By default, every tool returns MCP call `content` as the canonical response for
9
- LLMs. The text block contains the complete tool payload encoded as JSON using
10
- this common shape:
8
+ Every tool returns MCP call `content` as the canonical response for LLMs, in
9
+ plain text: the summary first, then any warnings, then the payload as lines.
10
+ The fields that identify one record share a line as `key=value` pairs, and a
11
+ value carrying spaces is quoted, as in `protocol="private - results"`. A record
12
+ that names a method opens with the method, written the way Pharo writes it:
13
+ `MCPTool>>batchSummaryNoun`, or `MCPTool class>>toolName` on the class side. A
14
+ list of plain values is bracketed, as in `required: [name, slotName]`, and a
15
+ list of records is named before its entries. Text with its own lines, such as
16
+ method source, follows under its own label. `tool_get` answers a tool's
17
+ contract as YAML.
18
+
19
+ A result does not repeat itself: what the summary states in prose, and what a
20
+ record already says another way, is left out of the lines.
21
+
22
+ The same payload is also carried as `structuredContent`:
11
23
 
12
24
  ```text
13
- status: ok | error
14
25
  summary: human-readable summary
15
26
  warnings: array of warning strings
16
27
  data: structured success payload
17
28
  error: structured error payload
18
29
  ```
19
30
 
20
- `data` is present on success. `error` is present on failure.
31
+ `data` is present on success. `error` is present on failure, where the call is
32
+ also flagged with the protocol's own `isError`.
21
33
 
22
34
  For clients or integrations that need programmatic payloads, configure the
23
35
  server response fields before `start`:
@@ -30,231 +42,139 @@ mcp useContentAndStructuredContentToolResponses.
30
42
 
31
43
  ## Compact Paging
32
44
 
33
- List and search tools are optimized for low token usage. Broad tools return a
34
- small page by default and put only the entry array in `data`. When another page
35
- exists, `data` includes `nextOffset`; call the same tool again with that
36
- `offset` to continue.
45
+ List and search tools are optimized for low token usage. A page is the tool's
46
+ own size, chosen for what one of its entries costs to read: fifty classes,
47
+ twenty-five methods or packages, twenty critique hits, ten repositories. When
48
+ another page exists, `data` includes `nextOffset`; call the same tool again
49
+ with that `offset` to continue.
37
50
 
38
- Use the returned array size for the current page and follow `nextOffset` when
39
- present. Request larger pages only when the next step truly needs more entries.
51
+ A search answers what identifies each hit, not everything known about it.
52
+ `repository_search` says how many packages a repository holds rather than
53
+ naming them, which `package_search` answers; `critique_run` names the rule
54
+ rather than restating its documentation on every hit.
40
55
 
41
- ## Tool Catalog
56
+ ## Naming Several Targets
42
57
 
43
- | Tool | Use |
44
- | --- | --- |
45
- | `tool_search` | Search the tool catalog by group, keyword, title, or description. |
46
- | `tool_get` | Return input schema and metadata for one catalog tool. |
47
- | `tool_call` | Invoke a catalog tool that is not exposed directly by the current client. |
58
+ Four tools act on several targets in one call. The argument that names the
59
+ target holds either one value or a list of them, and every other argument
60
+ applies to all of them:
48
61
 
49
- Use `tool_search` before calling less common or high-risk tools. Inspect the
50
- schema before invoking a discoverable tool.
62
+ | Tool | Argument | One call covers |
63
+ | --- | --- | --- |
64
+ | `method_get` | `selector` | Methods of one class, on one side. |
65
+ | `method_compile` | `source` | Sources compiled into one class, under one protocol. |
66
+ | `class_get` | `name` | Classes read with the same options. |
67
+ | `class_create` | `name` | Classes sharing a superclass, package and slots. |
51
68
 
52
- ## Repositories
69
+ Every target is attempted. The summary states how many succeeded, each target
70
+ then reads as it would have read on its own, and `data` carries one entry per
71
+ target under `results`, in request order. An entry that failed carries its
72
+ `error`. The call is flagged `isError` only when every target failed.
53
73
 
54
- | Tool | Use |
55
- | --- | --- |
56
- | `repository_search` | List Iceberg repositories registered in the image, including location, branch/head metadata, exact head commit id, modified packages, remotes, and upstream details. |
57
- | `repository_identity_verify` | Assert expected Iceberg repository identity fields before edits, exports, commits, pulls, or pushes. |
58
- | `repository_change_list` | Inspect Iceberg `workingCopyDiff` without writing files. |
59
- | `repository_create` | Create a new Iceberg repository directory and optionally attach initial packages. |
60
- | `repository_attach` | Register an existing Git checkout, including a linked Git worktree checkout, and optionally attach packages. |
61
- | `repository_update` | Change image-side repository subdirectory or package membership without exporting packages. |
62
- | `repository_export` | Export image-side package changes to Tonel files and update the Iceberg index without staging or committing Git changes. |
63
- | `repository_commit` | Commit Iceberg repository changes with a message. |
64
- | `repository_fetch` | Fetch repository remotes through Iceberg. |
65
- | `repository_pull` | Pull through Iceberg. |
66
- | `repository_push` | Push through Iceberg. |
67
- | `repository_branch_create` | Create and switch to a new repository branch through Iceberg. |
68
- | `repository_branch_switch` | Switch the Iceberg repository head to an existing branch without loading package changes into the image. |
69
- | `repository_branch_checkout` | Check out an existing repository branch and load changes for packages already loaded in the image. |
70
- | `repository_head_adopt` | Adopt the current repository head as the Iceberg working-copy reference after verifying the image and Git state. |
71
- | `baseline_load` | Load an already-known Metacello baseline available in the image. |
72
- | `repository_load` | Load a Metacello baseline from a remote repository. |
73
-
74
- Use `repository_identity_verify` before edits or exports, and
75
- `repository_change_list` before exporting or committing image changes.
76
- Identity verification requires at least one expected identity field, such as
77
- `location`, `branchName`, `subdirectory`, `packageNames`,
78
- `modifiedPackageNames`, or `isModified`.
79
-
80
- Use plural fields such as `repositoryNames`, `directoryPaths`, and
81
- `packageNames` for exact repository scope. Use singular text filters such as
82
- `repositoryName`, `branchName`, `headCommitId`, `remoteUrl`, and
83
- `upstreamBranchName` for field-specific matching.
84
-
85
- ## Packages
86
-
87
- | Tool | Use |
88
- | --- | --- |
89
- | `package_search` | List packages by project/package scope, with optional `packageName`, `projectName`, and `tag` filters. |
74
+ A call naming one target answers exactly what it answers when the argument
75
+ holds a single value.
90
76
 
91
- ## Classes
77
+ ## Changing A Class Or A Method
92
78
 
93
- | Tool | Use |
94
- | --- | --- |
95
- | `class_search` | List classes by package/class/hierarchy scope, with optional `className`, `tag`, `instanceSlot`, and `classSlot` filters. |
96
- | `class_get` | Get one class by name and return structured class metadata with optional superclass and subclass context. |
97
- | `class_create` | Create one class definition. |
98
- | `class_name_update` | Rename one class through the Refactoring Engine. |
99
- | `class_superclass_update` | Change one class superclass. |
100
- | `class_package_update` | Move one class to a package and/or recategorize it under a package tag. |
101
- | `class_comment_update` | Set or clear one class comment. |
102
- | `class_slots_update` | Replace instance-side and/or class-side slot definitions. |
103
- | `class_traits_update` | Replace instance-side trait composition. |
104
- | `class_side_traits_update` | Replace class-side trait composition. |
105
- | `class_shared_variables_update` | Replace class variables. |
106
- | `class_shared_pools_update` | Replace shared pools. |
107
- | `class_layout_update` | Replace the layout class. |
108
- | `class_slot_add` | Add one instance-side or class-side slot. |
109
- | `class_slot_remove` | Remove one instance-side or class-side slot. |
110
- | `class_slot_name_update` | Rename one instance-side or class-side slot. |
111
- | `class_slot_pull_up` | Pull one instance-side or class-side slot up to a superclass. |
112
- | `class_slot_push_down` | Push one instance-side or class-side slot down to subclasses. |
113
- | `class_remove` | Remove classes as one batch. Refactoring warnings stop removal unless `force=true`. |
114
-
115
- Class mutation tools and `class_remove` use Pharo refactoring support
116
- where available. With `force=false`, refactoring warnings return impact details
117
- instead of continuing.
118
-
119
- ## Methods
120
-
121
- | Tool | Use |
122
- | --- | --- |
123
- | `method_metadata_search` | List/search methods by class/package/hierarchy scope, with optional `selector` and `protocol` filters. |
124
- | `method_source_search` | Search methods by source text. |
125
- | `method_equivalent_search` | Search methods whose AST is equivalent to a referenced method. |
126
- | `method_implementor_search` | Search methods that implement a selector. |
127
- | `method_sender_search` | Search methods that send a selector. |
128
- | `method_class_reference_search` | Search methods that reference a class binding. |
129
- | `method_variable_reference_search` | Search methods that reference a variable. |
130
- | `method_get` | Get one known method and return source plus structured variable-reference context. |
131
- | `method_compile` | Create or replace one method from source. |
132
- | `method_selector_update` | Rename selectors, add/remove arguments, or reorder arguments through the Refactoring Engine. |
133
- | `method_protocol_update` | Move one method to another regular or extension protocol. |
134
- | `method_rewrite` | Preview or apply AST rewrite rules across a method scope. Applying requires `expectedChangeSetHash` from a preview. |
135
- | `critique_run` | Run selected or all Renraku critiques over a scope and return hits grouped by rule class. |
136
- | `method_remove` | Remove methods from one class as a batch without sender safety checks. |
137
-
138
- Prefer the specialized lookup tools for navigation tasks. Use
139
- `method_source_search` for source text and `method_equivalent_search` for
140
- equivalent-AST matches. Keep `method_metadata_search` for method metadata
141
- search. Top-level `method_metadata_search` filtering is limited to `selector`
142
- and `protocol` fields (`substring`, `prefix`, `exact`, or `regex`); use
143
- specialized tools for source, equivalent methods, implementors, senders, class
144
- references, and variable references.
145
-
146
- `method_compile` returns selected Renraku critiques after method compilation when
147
- they are relevant to review.
148
-
149
- ## History
150
-
151
- | Tool | Use |
152
- | --- | --- |
153
- | `history_file_list` | List Epicea `.ombu` change-history files, including the current history file. |
154
- | `history_entry_list` | List entries from the current image change history or a selected `.ombu` file. |
155
- | `history_entry_apply` | Preview applying selected entries, and apply them with `confirm=true`. |
156
- | `history_entry_revert` | Preview reverting selected entries, and revert them with `confirm=true`. |
79
+ `class_update` and `method_update` take the whole change rather than one
80
+ property each. Every property is optional and at least one is required;
81
+ omitted ones are left alone.
157
82
 
158
- Prefer the read-only tools when browsing history. Use
159
- `history_entry_apply` or `history_entry_revert` when you need apply/revert
160
- preview or confirmation.
83
+ Scalar properties are replaced by value, and so are the collections that hold
84
+ no state:
161
85
 
162
- ## Tests
86
+ ```text
87
+ class_update name, and any of newName, superclass, package, tag, comment,
88
+ layout, traits, classTraits, sharedVariables, sharedPools
89
+ ```
163
90
 
164
- | Tool | Use |
165
- | --- | --- |
166
- | `test_run` | Run SUnit test classes or individual methods. |
167
- | `test_coverage_run` | Run SUnit test classes or individual methods while collecting method and node coverage for an explicit method scope. |
91
+ Slots are patched instead, through `slots` and `classSlots`, because they hold
92
+ the instance's values. A replacement list cannot tell a rename from a
93
+ remove-plus-add, and the two differ in whether the value survives; it also has
94
+ to be complete, so a stale one silently drops a slot the caller did not know
95
+ about.
168
96
 
169
- ## UI
97
+ ```text
98
+ slots: { add: [names]
99
+ remove: [names]
100
+ rename: { current: new }
101
+ pullUp: [names] moves them to the superclass
102
+ pushDown: [names] moves them to every direct subclass
103
+ replace: [names] } the whole list; prefer add and remove
104
+ ```
170
105
 
171
- | Tool | Use |
172
- | --- | --- |
173
- | `screenshot_capture` | Capture the active Morphic world and return MCP image content with dimensions and MIME type metadata. |
106
+ `method_update` takes `class` and `selector`, then `protocol`, `newSelector`
107
+ or both. A selector change is classified by arity, so the one argument renames,
108
+ adds or removes arguments and updates senders. Name the new argument list in
109
+ `arguments` and the index map is worked out: names that match the current ones
110
+ are kept, new names are added arguments needing `argumentValueExpressions`, and
111
+ current names left out are removed. `permutation` is only for reordering, which
112
+ names cannot express.
174
113
 
175
- ## Debugging
114
+ The changes are applied in dependency order, not the order they were written:
115
+ a superclass change first, because it decides what the rest validates against,
116
+ slots added before anything refers to them and removed last, and a rename last,
117
+ because every other change resolves the target by the name the caller wrote.
176
118
 
177
- The debugger tools are discoverable under the `debugging` group. Read
178
- [Debugging with MCP](debugging.md) before using them.
119
+ A change that fails stops the ones after it. This is the opposite of a batch
120
+ over several targets, and deliberately so: these all land on one class or one
121
+ method, so carrying on would leave half a definition nobody asked for. The
122
+ error names the change that failed, the ones already applied, and the ones not
123
+ attempted.
179
124
 
180
- | Tool | Use |
181
- | --- | --- |
182
- | `debug_capture` | Evaluate a Smalltalk expression in a bounded worker process and capture runtime exceptions as tracked debug sessions. |
183
- | `debug_test_run` | Run one SUnit test method under debugger control and capture failures or errors as tracked debug sessions. |
184
- | `debug_session_list` | List tracked debug sessions. |
185
- | `debug_session_get` | Inspect one tracked debug session summary. |
186
- | `debug_session_remove` | Remove a tracked debug session from the registry. |
187
- | `debug_candidate_search` | Search unattached open debugger candidates. |
188
- | `debug_candidate_attach` | Attach an open debugger candidate and return its debug state. |
189
- | `debug_state_get` | Return a debug-session snapshot with stack, selected frame, source, scopes, repair actions, and state-scoped references. |
190
- | `debug_variable_get` | Expand scope and variable references returned by `debug_state_get`. |
191
- | `debug_expression_evaluate` | Evaluate a Smalltalk expression in a selected debug frame. |
192
- | `debug_session_step_into` | Step into the selected frame of a tracked debug session. |
193
- | `debug_session_step_over` | Step over the selected frame of a tracked debug session. |
194
- | `debug_session_step_through` | Step through the selected frame of a tracked debug session. |
195
- | `debug_session_restart` | Restart the selected frame of a tracked debug session. |
196
- | `debug_session_resume` | Resume a tracked debug session. |
197
- | `debug_session_terminate` | Terminate a tracked debug session. |
198
- | `debug_breakpoint_list` | List tracked transient DebugPoint breakpoints. |
199
- | `debug_breakpoint_set` | Install a transient method-entry or source-interval DebugPoint breakpoint. |
200
- | `debug_breakpoint_remove` | Remove one tracked transient DebugPoint breakpoint. |
201
- | `debug_breakpoint_enable` | Enable one tracked transient DebugPoint breakpoint. |
202
- | `debug_breakpoint_disable` | Disable one tracked transient DebugPoint breakpoint. |
203
- | `debug_breakpoint_clear` | Remove all tracked transient DebugPoint breakpoints. |
204
- | `debug_method_update` | Update the method associated with a paused debug state, then proceed when possible. |
125
+ ## The Advertised Surface
205
126
 
206
- ## Scripting
127
+ Fifteen tools are advertised directly: `tool_search`, `tool_get`, `tool_call`, `class_search`, `class_get`, `class_create`, `class_remove`, `method_search`, `method_source_search`, `method_reference_search`, `method_get`, `method_compile`, `method_remove`, `test_run` and `image_evaluate`. Every other tool is found with `tool_search` and called by name like any other; `tool_call` does the same for a client that will only send a name its own list holds.
207
128
 
208
- | Tool | Use |
129
+ A server chooses its own surface before `start`:
130
+
131
+ ```smalltalk
132
+ mcp advertiseTools: #( 'tool_search' 'tool_get' 'tool_call' 'method_get' ).
133
+ ```
134
+
135
+ ## Finding A Tool
136
+
137
+ The server answers for its own catalogue. `tool_search` ranks it by keyword,
138
+ best match first, and answers the closest tools even when none matches every
139
+ word; add words to narrow the ranking. With no query it answers the catalogue's
140
+ size and its groups. `tool_get` returns one tool's metadata and input schema,
141
+ and `tool_call` invokes a tool by nesting its arguments, for a client that cannot
142
+ send a name outside its own list.
143
+
144
+ Search before calling anything less common or high-risk, and read the schema
145
+ before invoking it.
146
+
147
+ Tools are named `domain_action`, and the domains are:
148
+
149
+ | Group | Covers |
209
150
  | --- | --- |
210
- | `image_evaluate` | Evaluate arbitrary Smalltalk and return a bounded preview of the result. |
151
+ | `classes` | Defining classes and changing their slots, traits, shared variables, pools, layout, package and comment, including the slot refactorings. |
152
+ | `methods` | Compiling, reading, removing and rewriting methods, renaming selectors and protocols, and searching by source, metadata, senders, implementors, references or equivalence. |
153
+ | `repositories` | What the image knows about its Iceberg repositories: identity, package membership, working-copy changes, export, commit, and reloading the image from the files. Branches, remotes and transfers are git's, and belong in a shell. |
154
+ | `debugging` | Reading the debuggers a person opened, with their exceptions and nearest frames, and watching what variables hold while an expression runs. Neither attaches to a debugger or leaves a session behind. |
155
+ | `history` | Epicea change history: locating files, listing entries, and applying or reverting them. |
156
+ | `tests` | Running tests and running them under coverage. |
157
+ | `packages` | Searching packages. |
158
+ | `runtime` | `image_evaluate`, the escape hatch. |
159
+ | `ui` | Reading what is on screen, as a tree of windows and the presenters or morphs inside them, or as a screenshot. Either one can take a single window instead of the whole world, for a fraction of the cost. |
160
+ | `tool-catalog` | `tool_search`, `tool_get` and `tool_call`. |
211
161
 
212
- Use `image_evaluate` only when no dedicated tool fits. A successful evaluation can
213
- mutate and save the image.
162
+ ## Scripting
214
163
 
215
- ## Mutation And Saving
164
+ Use `image_evaluate` only when no dedicated tool fits. A successful evaluation
165
+ can mutate the running image.
216
166
 
217
- Most search and inspection tools are read-only and do not save the image.
218
- Mutating tools save the image after a successful call.
167
+ ## Mutation And Saving
219
168
 
220
- Tools that can save after success include:
169
+ No tool saves the image. Mutating tools change the running image only, so
170
+ closing it discards every change since its last save, and a mistake costs the
171
+ session rather than the image file. Saving is the caller's responsibility:
172
+ evaluate `Smalltalk saveSession` when a change should survive, or leave it to
173
+ whoever owns the image lifecycle.
221
174
 
222
- ```text
223
- class_create
224
- class_name_update
225
- class_package_update
226
- class_comment_update
227
- class_slot_add
228
- class_slot_remove
229
- class_slot_name_update
230
- method_compile
231
- method_selector_update
232
- method_protocol_update
233
- repository_create
234
- repository_attach
235
- repository_update
236
- repository_export
237
- repository_commit
238
- repository_fetch
239
- repository_pull
240
- repository_push
241
- repository_branch_create
242
- repository_branch_switch
243
- repository_branch_checkout
244
- repository_head_adopt
245
- baseline_load
246
- repository_load
247
- class_remove
248
- method_remove
249
- method_rewrite when apply=true and changes were applied
250
- history_entry_apply when entries were performed
251
- history_entry_revert when entries were performed
252
- debug_expression_evaluate
253
- debug_capture
254
- debug_test_run
255
- debug_method_update when a method is accepted
256
- image_evaluate
257
- ```
175
+ Use `history_entry_list` to see what changed and `history_entry_revert` to undo
176
+ a change in the running image; both preview first and perform with
177
+ `confirm=true`.
258
178
 
259
179
  `repository_identity_verify` and `repository_change_list` are read-only.
260
180
 
@@ -11,7 +11,17 @@ change history.
11
11
 
12
12
  ## The Client Cannot Connect
13
13
 
14
- Check the server in the image:
14
+ Ask the image what servers it holds, which answers after a restart even when
15
+ nothing in the workspace refers to one:
16
+
17
+ ```smalltalk
18
+ MCP allServers.
19
+ ```
20
+
21
+ `Library → MCP Servers` in the world menu shows the same list, with the state,
22
+ port and endpoint of each, and starts or stops the one selected.
23
+
24
+ Check a server directly:
15
25
 
16
26
  ```smalltalk
17
27
  mcp isRunning.
@@ -55,7 +65,6 @@ Common causes:
55
65
  - missing required fields for the selected tool
56
66
  - extra fields rejected by `additionalProperties: false`
57
67
  - passing arguments from a different tool
58
- - `method_rewrite` with `apply=true` but no `expectedChangeSetHash`
59
68
  - `history_entry_apply` or `history_entry_revert` without `confirm=true`
60
69
 
61
70
  ## A Refactoring Stops With A Warning
@@ -79,7 +88,7 @@ Rerun with `force=true` only when the impact is acceptable.
79
88
  but Pharo found review issues. Inspect the critique rule class, title,
80
89
  description, and source interval if present.
81
90
 
82
- Use a follow-up `method_compile`, `method_selector_update`, `test_run`, or
91
+ Use a follow-up `method_compile`, `method_update`, `test_run`, or
83
92
  `method_get` call depending on the critique.
84
93
 
85
94
  ## Repository State Looks Wrong
@@ -109,23 +118,22 @@ Coverage scopes should be narrow: package, class, hierarchy, or method names.
109
118
 
110
119
  ## The Image Changed Unexpectedly
111
120
 
112
- Image-changing tools save the image after successful mutation. If you are using
113
- an automation or agent, run it against a copied or disposable image.
121
+ Image-changing tools change the running image without saving it. If you are
122
+ using an automation or agent, run it against a copied or disposable image.
114
123
 
115
124
  Use `history_file_list` and `history_entry_list` to inspect
116
125
  Epicea history. Apply or revert operations stay in `history_entry_apply` and
117
126
  `history_entry_revert`, where they can be previewed first and performed with
118
127
  `confirm=true`.
119
128
 
120
- ## Debugger References Are Stale
129
+ ## A Debugger Picture Goes Out Of Date
121
130
 
122
- Debugger `stateId`, `frameRef`, and `variableRef` values are scoped to one
123
- debug_state_get snapshot. After a control action, debugger edit, or resume, discard
124
- old references and use the newly returned state.
131
+ `debug_search` answers what is open at the moment it is called. A person can
132
+ step, resume or close their debugger at any time, so ask again rather than
133
+ acting on an older answer.
125
134
 
126
- If a human opened the debugger, attach through the debugging tools and let the
127
- debugger controller own UI actions. Do not drive debugger windows with raw
128
- `image_evaluate` code.
135
+ Do not drive debugger windows with raw `image_evaluate` code, and do not step,
136
+ resume or terminate a debugger a person opened.
129
137
 
130
138
  ## Source Checks Are Not Enough
131
139
 
@@ -17,8 +17,9 @@ guessing from source or memory.
17
17
 
18
18
  - Inspect the tools exposed by the current client; do not rely on remembered
19
19
  names or schemas.
20
- - Use `tool_search`, then `tool_get`, for less common tools. Invoke a catalog
21
- tool through `tool_call` when the client does not expose it directly.
20
+ - Use `tool_search`, then `tool_get`, for less common tools. Call one by name
21
+ like any other, or through `tool_call` when the client will only send a name
22
+ its own list holds.
22
23
  - Prefer the least-mutating dedicated tool. Use `image_evaluate` only when no
23
24
  dedicated tool fits.
24
25
  - Start list/search calls with the default page or a small `limit`. Continue
@@ -28,7 +29,7 @@ See [Tool reference](tool-reference.md) for tool groups and common workflows.
28
29
 
29
30
  ## Choose Specialized Lookups
30
31
 
31
- Use `method_metadata_search` for metadata, `method_source_search` for source,
32
+ Use `method_search` for metadata, `method_source_search` for source,
32
33
  `method_equivalent_search` for equivalent ASTs, and the implementor, sender,
33
34
  class-reference, or variable-reference search matching the question.
34
35
 
@@ -37,19 +38,39 @@ mutation, and inspect `repository_change_list` before export or commit. Read
37
38
  [Safety and ecosystem integration](safety-and-ecosystem.md) for mutation
38
39
  boundaries.
39
40
 
41
+ `method_get` and `class_get` read several targets in one call when their
42
+ `selector` or `name` holds a list, and `method_compile` and `class_create`
43
+ write several the same way. See [Tool reference](tool-reference.md).
44
+
40
45
  For history recovery, inspect files and entries before applying or reverting.
41
- For debugger sessions, breakpoints, or repairs, read the installed local
46
+ For watching values, debugger sessions, or repairs, read the installed local
42
47
  debugging guide.
43
48
 
44
49
  ## Image Mutation
45
50
 
46
- Successful mutating tools save the image. Use a copied or disposable image for
47
- broad or risky edits, preview changes when the tool supports it, and run focused
48
- tests after source changes.
51
+ Mutating tools change the running image and never save it, so closing the image
52
+ discards everything since its last save. Saving is the caller's responsibility:
53
+ evaluate `Smalltalk saveSession` when a change should survive, or leave it to
54
+ whoever owns the image lifecycle. Use a copied or disposable image for broad or
55
+ risky edits, preview changes when the tool supports it, and run focused tests
56
+ after source changes.
49
57
 
50
58
  Report incomplete or failing tool results clearly. Never silently fall back to
51
59
  exported source for a question about the live image.
52
60
 
61
+ ## Failures And Notifications
62
+
63
+ A notification is not a failure. Pharo signals them for remarks rather than
64
+ faults, and every `Warning` is one, so a deprecated send or an undeclared
65
+ variable during a load is resumed and the call proceeds. A refactoring warning
66
+ is the exception: it reports a change that breaks something, so it stops the
67
+ call until you rerun with `force=true`.
68
+
69
+ A failed call reports the error class, the message and the frames of the failing
70
+ code; the server's own frames are left out. For `image_evaluate` a compilation
71
+ failure also names the line and shows it, and a `MessageNotUnderstood` suggests
72
+ selectors the receiver does understand.
73
+
53
74
  ## Reusable Workflows
54
75
 
55
76
  Run `npx @evref-bl/pharo-mcp install --host <host>` in the target project to
@@ -86,10 +107,6 @@ MyProjectMCPTool >> buildInputSchema
86
107
  additionalProperties: false;
87
108
  yourself
88
109
 
89
- MyProjectMCPTool >> buildOutputSchema
90
-
91
- ^ self standardOutputSchemaForDataProperties: #( ) required: #( )
92
-
93
110
  MyProjectMCPTool >> executeWithRequest: request
94
111
 
95
112
  ^ self
@@ -107,49 +124,48 @@ MyProjectMCPTool class >> shouldAutoRegister
107
124
  ```
108
125
 
109
126
  Auto-registered external tools are discoverable by default. Agents can find
110
- them with `tool_search`, inspect them with `tool_get`, and call them through
111
- `tool_call`.
127
+ them with `tool_search`, inspect them with `tool_get`, and call them by name.
112
128
 
113
129
  `MCPToolRegistry` is the server's source of truth for registered tools. In
114
130
  normal use, configure it through the `MCP` instance messages below. The
115
131
  `tools/list` response contains only the static tool surface cached by the MCP
116
- instance; discoverable tools remain available through `tool_search`, `tool_get`,
117
- and `tool_call`.
132
+ instance; discoverable tools remain callable, and are found with `tool_search`
133
+ and `tool_get`.
134
+
135
+ Two words govern the surface. A **registered** tool is in the catalog, found
136
+ with `tool_search` and `tool_get`, and callable. An **advertised** tool is also
137
+ in `tools/list`. Advertising decides what a client is shown, not what it may
138
+ call.
118
139
 
119
- For a server with only your own tools, use a profile:
140
+ For a server with only your own tools:
120
141
 
121
142
  ```smalltalk
122
- mcp := MCP profile: (MCPProfile tools: { MyProjectMCPTool }).
143
+ mcp := MCP onlyTools: { MyProjectMCPTool }.
123
144
  mcp start.
124
145
  ```
125
146
 
126
- `MCPProfile tools:` registers the given tools and advertises them directly in
127
- `tools/list`. Use `tools:static:` when some registered tools should stay
128
- discoverable through the catalog tools:
147
+ `onlyTools:` replaces the catalog with exactly those tools and advertises all of
148
+ them. Advertise a subset when some registered tools should stay discoverable
149
+ through the catalog tools instead:
129
150
 
130
151
  ```smalltalk
131
- mcp := MCP profile: (MCPProfile
132
- tools: { MyProjectMCPTool. MyOtherMCPTool }
133
- static: { MyProjectMCPTool }).
152
+ mcp := MCP onlyTools: { MyProjectMCPTool. MyOtherMCPTool }.
153
+ mcp advertiseTools: { MyProjectMCPTool }.
134
154
  ```
135
155
 
136
- For incremental per-server configuration, register tools explicitly before
137
- starting the server:
156
+ To add to the tools a server already has, rather than replacing them:
138
157
 
139
158
  ```smalltalk
140
159
  mcp := MCP new.
141
- mcp registerToolClass: MyProjectMCPTool.
160
+ mcp addTool: MyProjectMCPTool.
142
161
  mcp start.
143
162
  ```
144
163
 
145
- You can also register several classes, register an already-created tool, or
146
- remove a tool from one server instance:
147
-
148
- ```smalltalk
149
- mcp registerToolClasses: { MyProjectMCPTool. MyOtherMCPTool }.
150
- mcp registerTool: MyProjectMCPTool new.
151
- mcp unregisterToolNamed: 'my_project_tool'.
152
- ```
164
+ `addTool:` takes a class or a ready instance, and `addTools:` takes several.
165
+ `removeTool:` takes one back out by name. `advertiseTools:` accepts classes,
166
+ instances or names, and registers anything not in the catalog yet, so it can be
167
+ called before or after adding. `advertiseAllTools` advertises everything, and
168
+ `advertiseToolDefaults` returns to each tool's own default exposure.
153
169
 
154
170
  Use `defaultExposure` to decide whether a registered tool is directly
155
171
  advertised in `tools/list` (`'static'`) or kept discoverable through the catalog