@evref-bl/pharo-mcp 0.0.0-stage → 1.4.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.
- package/README.md +79 -2
- package/bin/pharo-mcp.js +22 -0
- package/node/index.js +1 -0
- package/node/installer.js +151 -0
- package/package.json +33 -4
- package/templates/.claude/mcp.json +8 -0
- package/templates/.codex/config.toml +4 -0
- package/templates/.opencode/opencode.json +10 -0
- package/templates/pharo-references/debugger-driven-development.md +101 -0
- package/templates/pharo-references/debugging.md +147 -0
- package/templates/pharo-references/getting-started.md +143 -0
- package/templates/pharo-references/pharo-coding-rules.md +147 -0
- package/templates/pharo-references/pharo-coding-style.md +139 -0
- package/templates/pharo-references/safety-and-ecosystem.md +256 -0
- package/templates/pharo-references/source-vs-live-image.md +75 -0
- package/templates/pharo-references/tool-reference.md +273 -0
- package/templates/pharo-references/troubleshooting.md +137 -0
- package/templates/pharo-references/using-pharo-mcp.md +156 -0
- package/templates/pharo-skills/pharo-ci-repro/SKILL.md +46 -0
- package/templates/pharo-skills/pharo-ci-repro/agents/openai.yaml +4 -0
- package/templates/pharo-skills/pharo-ci-repro/references/pharo-smalltalkci.md +102 -0
- package/templates/pharo-skills/pharo-ci-repro/scripts/run-smalltalkci-docker.sh +172 -0
- package/templates/pharo-skills/pharo-image-git-handoff/SKILL.md +37 -0
- package/templates/pharo-skills/pharo-image-git-handoff/agents/openai.yaml +4 -0
- package/templates/pharo-skills/pharo-mcp-recovery/SKILL.md +34 -0
- package/templates/pharo-skills/pharo-mcp-recovery/agents/openai.yaml +4 -0
- package/templates/pharo-skills/pharo-project-load/SKILL.md +47 -0
- package/templates/pharo-skills/pharo-project-load/agents/openai.yaml +4 -0
- package/templates/pharo-skills/pharo-version-compat/SKILL.md +57 -0
- package/templates/pharo-skills/pharo-version-compat/agents/openai.yaml +4 -0
- package/templates/pharo.AGENTS.md +42 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Source Files Vs Live Pharo Image State
|
|
2
|
+
|
|
3
|
+
Applies when an agent uses the Pharo MCP server to inspect, modify, or verify a
|
|
4
|
+
Pharo project.
|
|
5
|
+
|
|
6
|
+
## Goal
|
|
7
|
+
|
|
8
|
+
Keep source inspection, loaded image state, Iceberg state, and Git state
|
|
9
|
+
separate. Each one can answer different questions, and none should be treated
|
|
10
|
+
as a substitute for the others.
|
|
11
|
+
|
|
12
|
+
## Source-Only Checks
|
|
13
|
+
|
|
14
|
+
Source-only checks can confirm:
|
|
15
|
+
|
|
16
|
+
- files exist where expected;
|
|
17
|
+
- packages, classes, and methods are exported in Tonel;
|
|
18
|
+
- baseline files and package declarations look coherent;
|
|
19
|
+
- static documentation and scripts are present;
|
|
20
|
+
- Git diffs contain the expected source changes;
|
|
21
|
+
- formatting and whitespace checks pass.
|
|
22
|
+
|
|
23
|
+
Source-only checks cannot prove:
|
|
24
|
+
|
|
25
|
+
- the project loads in the image;
|
|
26
|
+
- classes and methods are currently loaded;
|
|
27
|
+
- tools see the expected image state;
|
|
28
|
+
- tests pass inside the image;
|
|
29
|
+
- image-side edits were exported to source;
|
|
30
|
+
- the running server or application behaves correctly.
|
|
31
|
+
|
|
32
|
+
## Live Image Checks
|
|
33
|
+
|
|
34
|
+
Use live image checks when the answer depends on image state:
|
|
35
|
+
|
|
36
|
+
- loading a baseline or package;
|
|
37
|
+
- listing loaded repositories, packages, classes, or methods;
|
|
38
|
+
- inspecting compiled methods or class definitions;
|
|
39
|
+
- running SUnit tests;
|
|
40
|
+
- starting or exercising a server/application in the image;
|
|
41
|
+
- applying image-side edits;
|
|
42
|
+
- exporting image-side changes to Tonel or Git.
|
|
43
|
+
|
|
44
|
+
Prefer dedicated `pharo` MCP tools for these checks. Use `image_evaluate` only
|
|
45
|
+
when no dedicated tool fits.
|
|
46
|
+
|
|
47
|
+
## Iceberg And Git
|
|
48
|
+
|
|
49
|
+
Remember:
|
|
50
|
+
|
|
51
|
+
- Tonel files are exported source.
|
|
52
|
+
- The loaded image can differ from Tonel files.
|
|
53
|
+
- Iceberg working-copy state can differ from both image state and Git state.
|
|
54
|
+
- Git commits record disk files, not unsaved image changes.
|
|
55
|
+
|
|
56
|
+
When these states disagree, report the mismatch and resolve it deliberately.
|
|
57
|
+
Do not claim a change is complete just because one layer looks correct.
|
|
58
|
+
|
|
59
|
+
## Blocked Live Verification
|
|
60
|
+
|
|
61
|
+
If the current context does not have a safe or approved live image:
|
|
62
|
+
|
|
63
|
+
- run only source-safe checks;
|
|
64
|
+
- say which live checks are still needed;
|
|
65
|
+
- do not use image-side evaluation or mutation as a workaround;
|
|
66
|
+
- do not claim live behavior is verified.
|
|
67
|
+
|
|
68
|
+
## Reporting
|
|
69
|
+
|
|
70
|
+
When finishing work, report:
|
|
71
|
+
|
|
72
|
+
- source checks run;
|
|
73
|
+
- live image checks run;
|
|
74
|
+
- live checks not run and why;
|
|
75
|
+
- any image/source/Iceberg/Git state mismatch observed.
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Tool Reference
|
|
2
|
+
|
|
3
|
+
MCP exposes tools through `tools/list` and `tools/call`. Common tools can be
|
|
4
|
+
advertised directly; less common tools can be found through the catalog tools.
|
|
5
|
+
Tool names use `snake_case` names that generally put the domain before the
|
|
6
|
+
action.
|
|
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:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
status: ok | error
|
|
14
|
+
summary: human-readable summary
|
|
15
|
+
warnings: array of warning strings
|
|
16
|
+
data: structured success payload
|
|
17
|
+
error: structured error payload
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`data` is present on success. `error` is present on failure.
|
|
21
|
+
|
|
22
|
+
For clients or integrations that need programmatic payloads, configure the
|
|
23
|
+
server response fields before `start`:
|
|
24
|
+
|
|
25
|
+
```smalltalk
|
|
26
|
+
mcp useContentOnlyToolResponses. "default"
|
|
27
|
+
mcp useStructuredContentOnlyToolResponses.
|
|
28
|
+
mcp useContentAndStructuredContentToolResponses.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Compact Paging
|
|
32
|
+
|
|
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.
|
|
37
|
+
|
|
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.
|
|
40
|
+
|
|
41
|
+
## Tool Catalog
|
|
42
|
+
|
|
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. |
|
|
48
|
+
|
|
49
|
+
Use `tool_search` before calling less common or high-risk tools. Inspect the
|
|
50
|
+
schema before invoking a discoverable tool.
|
|
51
|
+
|
|
52
|
+
## Repositories
|
|
53
|
+
|
|
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. |
|
|
90
|
+
|
|
91
|
+
## Classes
|
|
92
|
+
|
|
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`. |
|
|
157
|
+
|
|
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.
|
|
161
|
+
|
|
162
|
+
## Tests
|
|
163
|
+
|
|
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. |
|
|
168
|
+
|
|
169
|
+
## UI
|
|
170
|
+
|
|
171
|
+
| Tool | Use |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| `screenshot_capture` | Capture the active Morphic world and return MCP image content with dimensions and MIME type metadata. |
|
|
174
|
+
|
|
175
|
+
## Debugging
|
|
176
|
+
|
|
177
|
+
The debugger tools are discoverable under the `debugging` group. Read
|
|
178
|
+
[Debugging with MCP](debugging.md) before using them.
|
|
179
|
+
|
|
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. |
|
|
205
|
+
|
|
206
|
+
## Scripting
|
|
207
|
+
|
|
208
|
+
| Tool | Use |
|
|
209
|
+
| --- | --- |
|
|
210
|
+
| `image_evaluate` | Evaluate arbitrary Smalltalk and return a bounded preview of the result. |
|
|
211
|
+
|
|
212
|
+
Use `image_evaluate` only when no dedicated tool fits. A successful evaluation can
|
|
213
|
+
mutate and save the image.
|
|
214
|
+
|
|
215
|
+
## Mutation And Saving
|
|
216
|
+
|
|
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.
|
|
219
|
+
|
|
220
|
+
Tools that can save after success include:
|
|
221
|
+
|
|
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
|
+
```
|
|
258
|
+
|
|
259
|
+
`repository_identity_verify` and `repository_change_list` are read-only.
|
|
260
|
+
|
|
261
|
+
## Refactoring Warnings
|
|
262
|
+
|
|
263
|
+
For edit tools that use refactoring operations, `force=false` is the default.
|
|
264
|
+
When Pharo raises `RBRefactoringWarning`, the tool returns an error with:
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
impactMessages
|
|
268
|
+
howToProceed
|
|
269
|
+
forceSupported: true
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Rerun with `force=true` only after reviewing the impact. Forced warnings are
|
|
273
|
+
returned as normal warnings in the successful result.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Most failures fall into one of three groups: the image is not reachable, the
|
|
4
|
+
requested tool input is invalid, or the live image state differs from what the
|
|
5
|
+
caller expected.
|
|
6
|
+
|
|
7
|
+
For standalone image crashes or stopped servers, the installed
|
|
8
|
+
`pharo-mcp-recovery` skill gives agents a recovery workflow for preserving
|
|
9
|
+
evidence, restarting or replacing the image, reloading projects, and recovering
|
|
10
|
+
change history.
|
|
11
|
+
|
|
12
|
+
## The Client Cannot Connect
|
|
13
|
+
|
|
14
|
+
Check the server in the image:
|
|
15
|
+
|
|
16
|
+
```smalltalk
|
|
17
|
+
mcp isRunning.
|
|
18
|
+
mcp isListening.
|
|
19
|
+
mcp localUrlString.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Confirm that the client URL uses the same host and port:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
http://127.0.0.1:4000
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you changed the port in Pharo, update the MCP client configuration.
|
|
29
|
+
|
|
30
|
+
MCP currently handles MCP calls over HTTP POST. Unsupported HTTP methods
|
|
31
|
+
return method-not-allowed instead of hanging.
|
|
32
|
+
|
|
33
|
+
## `tools/list` Is Empty Or Stale
|
|
34
|
+
|
|
35
|
+
Run:
|
|
36
|
+
|
|
37
|
+
```smalltalk
|
|
38
|
+
mcp refreshToolsList.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then call `tools/list` again. If you loaded new MCP code into the image, restart
|
|
42
|
+
the server:
|
|
43
|
+
|
|
44
|
+
```smalltalk
|
|
45
|
+
mcp restart.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## A Tool Rejects Input
|
|
49
|
+
|
|
50
|
+
Each tool validates arguments against its input schema. Call `tools/list` and
|
|
51
|
+
inspect the tool's `inputSchema`.
|
|
52
|
+
|
|
53
|
+
Common causes:
|
|
54
|
+
|
|
55
|
+
- missing required fields for the selected tool
|
|
56
|
+
- extra fields rejected by `additionalProperties: false`
|
|
57
|
+
- passing arguments from a different tool
|
|
58
|
+
- `method_rewrite` with `apply=true` but no `expectedChangeSetHash`
|
|
59
|
+
- `history_entry_apply` or `history_entry_revert` without `confirm=true`
|
|
60
|
+
|
|
61
|
+
## A Refactoring Stops With A Warning
|
|
62
|
+
|
|
63
|
+
This is expected for Pharo refactoring warnings. With `force=false`, the edit
|
|
64
|
+
tool stops and returns impact details.
|
|
65
|
+
|
|
66
|
+
Read:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
impactMessages
|
|
70
|
+
howToProceed
|
|
71
|
+
forceSupported
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Rerun with `force=true` only when the impact is acceptable.
|
|
75
|
+
|
|
76
|
+
## A Method Compiles But Returns Critiques
|
|
77
|
+
|
|
78
|
+
`method_compile` can return Renraku critiques after compilation. The method exists,
|
|
79
|
+
but Pharo found review issues. Inspect the critique rule class, title,
|
|
80
|
+
description, and source interval if present.
|
|
81
|
+
|
|
82
|
+
Use a follow-up `method_compile`, `method_selector_update`, `test_run`, or
|
|
83
|
+
`method_get` call depending on the critique.
|
|
84
|
+
|
|
85
|
+
## Repository State Looks Wrong
|
|
86
|
+
|
|
87
|
+
MCP reads repository state from Iceberg in the running image. The exported
|
|
88
|
+
Tonel files, the image's loaded packages, and Iceberg's working-copy state can
|
|
89
|
+
differ.
|
|
90
|
+
|
|
91
|
+
Start with:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
repository_search
|
|
95
|
+
repository_identity_verify
|
|
96
|
+
repository_change_list
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Use `repository_export` only when you mean to write image changes to files.
|
|
100
|
+
Export updates the Iceberg index but does not stage or commit Git changes.
|
|
101
|
+
|
|
102
|
+
## Tests Do Not Prove The Edited Scope
|
|
103
|
+
|
|
104
|
+
`test_run` tells you whether selected tests passed. Use `test_coverage_run` with
|
|
105
|
+
an explicit coverage scope when you need to know whether the edited methods
|
|
106
|
+
executed.
|
|
107
|
+
|
|
108
|
+
Coverage scopes should be narrow: package, class, hierarchy, or method names.
|
|
109
|
+
|
|
110
|
+
## The Image Changed Unexpectedly
|
|
111
|
+
|
|
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.
|
|
114
|
+
|
|
115
|
+
Use `history_file_list` and `history_entry_list` to inspect
|
|
116
|
+
Epicea history. Apply or revert operations stay in `history_entry_apply` and
|
|
117
|
+
`history_entry_revert`, where they can be previewed first and performed with
|
|
118
|
+
`confirm=true`.
|
|
119
|
+
|
|
120
|
+
## Debugger References Are Stale
|
|
121
|
+
|
|
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.
|
|
125
|
+
|
|
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.
|
|
129
|
+
|
|
130
|
+
## Source Checks Are Not Enough
|
|
131
|
+
|
|
132
|
+
Exported source files can confirm package layout, class definitions, and docs.
|
|
133
|
+
They cannot prove that the running image has loaded the latest code or that an
|
|
134
|
+
MCP tool works over HTTP.
|
|
135
|
+
|
|
136
|
+
Use [Source vs live image](source-vs-live-image.md) to decide which checks are
|
|
137
|
+
valid for the current work boundary.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Using The Pharo MCP Server
|
|
2
|
+
|
|
3
|
+
Applies when an agent or user interacts with a running Pharo image through MCP.
|
|
4
|
+
Follow [Getting started](getting-started.md) to load, start, and connect first.
|
|
5
|
+
|
|
6
|
+
## Source Of Truth
|
|
7
|
+
|
|
8
|
+
Use the running image for live classes, methods, packages, repositories, and
|
|
9
|
+
tests. Tonel source, Iceberg, and Git are separate state layers; read
|
|
10
|
+
[Source files vs live image state](source-vs-live-image.md) before reasoning
|
|
11
|
+
across them.
|
|
12
|
+
|
|
13
|
+
If image access is unavailable, state which live check is blocked instead of
|
|
14
|
+
guessing from source or memory.
|
|
15
|
+
|
|
16
|
+
## Discover Before Calling
|
|
17
|
+
|
|
18
|
+
- Inspect the tools exposed by the current client; do not rely on remembered
|
|
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.
|
|
22
|
+
- Prefer the least-mutating dedicated tool. Use `image_evaluate` only when no
|
|
23
|
+
dedicated tool fits.
|
|
24
|
+
- Start list/search calls with the default page or a small `limit`. Continue
|
|
25
|
+
only when the result contains `nextOffset`.
|
|
26
|
+
|
|
27
|
+
See [Tool reference](tool-reference.md) for tool groups and common workflows.
|
|
28
|
+
|
|
29
|
+
## Choose Specialized Lookups
|
|
30
|
+
|
|
31
|
+
Use `method_metadata_search` for metadata, `method_source_search` for source,
|
|
32
|
+
`method_equivalent_search` for equivalent ASTs, and the implementor, sender,
|
|
33
|
+
class-reference, or variable-reference search matching the question.
|
|
34
|
+
|
|
35
|
+
For repository work, inspect with `repository_search`, verify identity before
|
|
36
|
+
mutation, and inspect `repository_change_list` before export or commit. Read
|
|
37
|
+
[Safety and ecosystem integration](safety-and-ecosystem.md) for mutation
|
|
38
|
+
boundaries.
|
|
39
|
+
|
|
40
|
+
For history recovery, inspect files and entries before applying or reverting.
|
|
41
|
+
For debugger sessions, breakpoints, or repairs, read the installed local
|
|
42
|
+
debugging guide.
|
|
43
|
+
|
|
44
|
+
## Image Mutation
|
|
45
|
+
|
|
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.
|
|
49
|
+
|
|
50
|
+
Report incomplete or failing tool results clearly. Never silently fall back to
|
|
51
|
+
exported source for a question about the live image.
|
|
52
|
+
|
|
53
|
+
## Reusable Workflows
|
|
54
|
+
|
|
55
|
+
Run `npx @evref-bl/pharo-mcp install --host <host>` in the target project to
|
|
56
|
+
install context-routed skills for project loading, version compatibility,
|
|
57
|
+
image-to-Git handoff, CI reproduction, and standalone MCP recovery.
|
|
58
|
+
|
|
59
|
+
## Custom Tools
|
|
60
|
+
|
|
61
|
+
Define custom tools as subclasses of `MCPTool` in your own package. At minimum,
|
|
62
|
+
provide the class-side tool name and the instance-side metadata, schema, and
|
|
63
|
+
execution protocol expected by `MCPTool`:
|
|
64
|
+
|
|
65
|
+
```smalltalk
|
|
66
|
+
MCPTool << #MyProjectMCPTool
|
|
67
|
+
slots: {};
|
|
68
|
+
package: 'MyProject-MCP'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```smalltalk
|
|
72
|
+
MyProjectMCPTool class >> toolName
|
|
73
|
+
|
|
74
|
+
^ 'my_project_tool'
|
|
75
|
+
|
|
76
|
+
MyProjectMCPTool >> description
|
|
77
|
+
|
|
78
|
+
^ 'Do one project-specific operation.'
|
|
79
|
+
|
|
80
|
+
MyProjectMCPTool >> buildInputSchema
|
|
81
|
+
|
|
82
|
+
^ MCPStructureInputSchema new
|
|
83
|
+
type: 'object';
|
|
84
|
+
properties: #( );
|
|
85
|
+
required: #( );
|
|
86
|
+
additionalProperties: false;
|
|
87
|
+
yourself
|
|
88
|
+
|
|
89
|
+
MyProjectMCPTool >> buildOutputSchema
|
|
90
|
+
|
|
91
|
+
^ self standardOutputSchemaForDataProperties: #( ) required: #( )
|
|
92
|
+
|
|
93
|
+
MyProjectMCPTool >> executeWithRequest: request
|
|
94
|
+
|
|
95
|
+
^ self
|
|
96
|
+
successResultText: 'Operation completed.'
|
|
97
|
+
data: Dictionary new
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
By default, tools outside the MCP package are not auto-registered. If your
|
|
101
|
+
package intentionally publishes a tool whenever it is loaded, opt in:
|
|
102
|
+
|
|
103
|
+
```smalltalk
|
|
104
|
+
MyProjectMCPTool class >> shouldAutoRegister
|
|
105
|
+
|
|
106
|
+
^ true
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
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`.
|
|
112
|
+
|
|
113
|
+
`MCPToolRegistry` is the server's source of truth for registered tools. In
|
|
114
|
+
normal use, configure it through the `MCP` instance messages below. The
|
|
115
|
+
`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`.
|
|
118
|
+
|
|
119
|
+
For a server with only your own tools, use a profile:
|
|
120
|
+
|
|
121
|
+
```smalltalk
|
|
122
|
+
mcp := MCP profile: (MCPProfile tools: { MyProjectMCPTool }).
|
|
123
|
+
mcp start.
|
|
124
|
+
```
|
|
125
|
+
|
|
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:
|
|
129
|
+
|
|
130
|
+
```smalltalk
|
|
131
|
+
mcp := MCP profile: (MCPProfile
|
|
132
|
+
tools: { MyProjectMCPTool. MyOtherMCPTool }
|
|
133
|
+
static: { MyProjectMCPTool }).
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For incremental per-server configuration, register tools explicitly before
|
|
137
|
+
starting the server:
|
|
138
|
+
|
|
139
|
+
```smalltalk
|
|
140
|
+
mcp := MCP new.
|
|
141
|
+
mcp registerToolClass: MyProjectMCPTool.
|
|
142
|
+
mcp start.
|
|
143
|
+
```
|
|
144
|
+
|
|
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
|
+
```
|
|
153
|
+
|
|
154
|
+
Use `defaultExposure` to decide whether a registered tool is directly
|
|
155
|
+
advertised in `tools/list` (`'static'`) or kept discoverable through the catalog
|
|
156
|
+
tools (`'discoverable'`, the default).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pharo-ci-repro
|
|
3
|
+
description: Reproduce Pharo smalltalkCI or GitHub Actions failures locally, preferably in Docker; preserve logs; narrow flaky tests; and distinguish project, compatibility, VM/native, and external-service failures.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pharo CI Repro
|
|
7
|
+
|
|
8
|
+
## Context
|
|
9
|
+
|
|
10
|
+
Read the failing workflow, `.smalltalk.ston`, project load instructions, commit,
|
|
11
|
+
and supported Pharo matrix. Read `references/pharo-smalltalkci.md` after a run
|
|
12
|
+
produces logs.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Record platform, config path, revision, and failing phase: download, load,
|
|
17
|
+
tests, coverage, or teardown.
|
|
18
|
+
2. Check `git status --short --branch`. Use a clean failing revision for exact
|
|
19
|
+
reproduction or an isolated scratch copy for local fixes.
|
|
20
|
+
3. Run one faithful Docker/smalltalkCI reproduction and preserve its first
|
|
21
|
+
failing log. Confirm the Docker CLI and daemon before falling back.
|
|
22
|
+
4. Use local smalltalkCI only when containers are unavailable or OS/runtime
|
|
23
|
+
fidelity is irrelevant; isolate its checkout/home per parallel job.
|
|
24
|
+
5. After reproducing, narrow with a temporary smalltalkCI config for one class
|
|
25
|
+
or package. Repeat focused runs for flakes.
|
|
26
|
+
6. Classify the result as project, compatibility, VM/native, or external.
|
|
27
|
+
7. Verify the fix on every affected CI platform and repeat the flaky target.
|
|
28
|
+
|
|
29
|
+
## Helper
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
skills/pharo-ci-repro/scripts/run-smalltalkci-docker.sh \
|
|
33
|
+
--repo /path/to/repo \
|
|
34
|
+
--platform Pharo64-13 \
|
|
35
|
+
--attempts 3
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use `--spec` for a focused config, `--out` for logs, and `--keep-going` to
|
|
39
|
+
collect multiple failures. Use `--include-git` only for ordinary checkouts;
|
|
40
|
+
linked worktree `.git` files point outside a copied tree.
|
|
41
|
+
|
|
42
|
+
## Report
|
|
43
|
+
|
|
44
|
+
Report exact commands, image/VM versions, first failing phase, relevant
|
|
45
|
+
Smalltalk/native frames, log paths, diagnosis class, changes made, and matrix
|
|
46
|
+
verification. Keep native-crash conclusions cautious.
|