@evref-bl/pharo-mcp 2.3.0 → 3.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.
@@ -1,172 +0,0 @@
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. 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.
23
- - Prefer the least-mutating dedicated tool. Use `image_evaluate` only when no
24
- dedicated tool fits.
25
- - Start list/search calls with the default page or a small `limit`. Continue
26
- only when the result contains `nextOffset`.
27
-
28
- See [Tool reference](tool-reference.md) for tool groups and common workflows.
29
-
30
- ## Choose Specialized Lookups
31
-
32
- Use `method_search` for metadata, `method_source_search` for source,
33
- `method_equivalent_search` for equivalent ASTs, and the implementor, sender,
34
- class-reference, or variable-reference search matching the question.
35
-
36
- For repository work, inspect with `repository_search`, verify identity before
37
- mutation, and inspect `repository_change_list` before export or commit. Read
38
- [Safety and ecosystem integration](safety-and-ecosystem.md) for mutation
39
- boundaries.
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
-
45
- For history recovery, inspect files and entries before applying or reverting.
46
- For watching values, debugger sessions, or repairs, read the installed local
47
- debugging guide.
48
-
49
- ## Image Mutation
50
-
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.
57
-
58
- Report incomplete or failing tool results clearly. Never silently fall back to
59
- exported source for a question about the live image.
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
-
74
- ## Reusable Workflows
75
-
76
- Run `npx @evref-bl/pharo-mcp install --host <host>` in the target project to
77
- install context-routed skills for project loading, version compatibility,
78
- image-to-Git handoff, CI reproduction, and standalone MCP recovery.
79
-
80
- ## Custom Tools
81
-
82
- Define custom tools as subclasses of `MCPTool` in your own package. At minimum,
83
- provide the class-side tool name and the instance-side metadata, schema, and
84
- execution protocol expected by `MCPTool`:
85
-
86
- ```smalltalk
87
- MCPTool << #MyProjectMCPTool
88
- slots: {};
89
- package: 'MyProject-MCP'
90
- ```
91
-
92
- ```smalltalk
93
- MyProjectMCPTool class >> toolName
94
-
95
- ^ 'my_project_tool'
96
-
97
- MyProjectMCPTool >> description
98
-
99
- ^ 'Do one project-specific operation.'
100
-
101
- MyProjectMCPTool >> buildInputSchema
102
-
103
- ^ MCPStructureInputSchema new
104
- type: 'object';
105
- properties: #( );
106
- required: #( );
107
- additionalProperties: false;
108
- yourself
109
-
110
- MyProjectMCPTool >> executeWithRequest: request
111
-
112
- ^ self
113
- successResultText: 'Operation completed.'
114
- data: Dictionary new
115
- ```
116
-
117
- By default, tools outside the MCP package are not auto-registered. If your
118
- package intentionally publishes a tool whenever it is loaded, opt in:
119
-
120
- ```smalltalk
121
- MyProjectMCPTool class >> shouldAutoRegister
122
-
123
- ^ true
124
- ```
125
-
126
- Auto-registered external tools are discoverable by default. Agents can find
127
- them with `tool_search`, inspect them with `tool_get`, and call them by name.
128
-
129
- `MCPToolRegistry` is the server's source of truth for registered tools. In
130
- normal use, configure it through the `MCP` instance messages below. The
131
- `tools/list` response contains only the static tool surface cached by the MCP
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.
139
-
140
- For a server with only your own tools:
141
-
142
- ```smalltalk
143
- mcp := MCP onlyTools: { MyProjectMCPTool }.
144
- mcp start.
145
- ```
146
-
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:
150
-
151
- ```smalltalk
152
- mcp := MCP onlyTools: { MyProjectMCPTool. MyOtherMCPTool }.
153
- mcp advertiseTools: { MyProjectMCPTool }.
154
- ```
155
-
156
- To add to the tools a server already has, rather than replacing them:
157
-
158
- ```smalltalk
159
- mcp := MCP new.
160
- mcp addTool: MyProjectMCPTool.
161
- mcp start.
162
- ```
163
-
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.
169
-
170
- Use `defaultExposure` to decide whether a registered tool is directly
171
- advertised in `tools/list` (`'static'`) or kept discoverable through the catalog
172
- tools (`'discoverable'`, the default).
@@ -1,40 +0,0 @@
1
- ---
2
- name: pharo-image-git-handoff
3
- description: Reconcile live Pharo, Iceberg, Tonel, and Git state before exporting, reviewing, committing, or pushing image-side changes. Use for dirty or detached Iceberg state, linked worktrees, package-membership mismatches, and image-to-Git delivery.
4
- ---
5
-
6
- # Pharo Image Git Handoff
7
-
8
- Image objects, Tonel files, Iceberg working copies, and Git refs are distinct.
9
- A clean Git worktree does not prove the image is clean, and an Iceberg diff does
10
- not prove files changed on disk.
11
-
12
- ## Workflow
13
-
14
- 1. Inspect the image repository with Pharo MCP tools: identity, location,
15
- branch/head, source directory, package membership, and modified packages.
16
- 2. Inspect disk with read-only Git commands: `git status --short --branch`,
17
- `git diff`, and `git remote -v`.
18
- 3. Export only for an intended Tonel/Git handoff. Verify repository identity and
19
- inspect the image-side change list first.
20
- 4. After export, recheck Iceberg and Git. Review every changed Tonel, project,
21
- and documentation path.
22
- 5. Commit only the intended diff. Push only when explicitly requested or
23
- clearly approved.
24
- 6. When the checkout moves under the image — switching branch, pulling, or any
25
- Git command that rewrites the source files — reload the image from those
26
- files afterwards, or it keeps running the code the old checkout held.
27
-
28
- ## Stop Before Mutation
29
-
30
- Stop and diagnose detached or missing heads, wrong branches/remotes, duplicate
31
- repository names, source-directory or package-membership mismatches, linked
32
- worktree confusion, and unexplained disagreement between Git and Iceberg.
33
-
34
- Adopt the current Git HEAD only when the image contents are known to match it.
35
- Ask the user before resolving real divergence or discarding image changes.
36
-
37
- ## Report
38
-
39
- Report image repository state before and after export, why export was needed,
40
- Git branch/status and diff summary, checks run, and unresolved ambiguity.
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "Pharo Image Git Handoff"
3
- short_description: "Export Pharo image changes safely"
4
- default_prompt: "Use $pharo-image-git-handoff to turn these Pharo image changes into clean Tonel/Git changes safely."
@@ -1,54 +0,0 @@
1
- ---
2
- name: pharo-version-compat
3
- description: Use PharoBackwardCompatibility to load and test a project developed on a later Pharo across supported older versions. Use for missing APIs, selectors, packages, notices, or semantics and reusable upstream backports.
4
- ---
5
-
6
- # Pharo Version Compatibility
7
-
8
- ## Model
9
-
10
- `PharoBackwardCompatibility` backports later Pharo APIs to older supported
11
- images. Develop against the newest supported Pharo and let the dependency load
12
- the packages needed by the current image.
13
-
14
- It has no source-surface group: load its default baseline.
15
-
16
- ## Workflow
17
-
18
- 1. Read the project baseline, supported-version policy, and CI matrix.
19
- 2. Identify the newest source Pharo version and target runtime versions.
20
- 3. Load PBC from the project baseline:
21
-
22
- ```smalltalk
23
- spec
24
- baseline: 'PharoBackwardCompatibility'
25
- with: [
26
- spec repository: 'github://jecisc/PharoBackwardCompatibility:v1.x.x/src' ]
27
- ```
28
-
29
- 4. Reproduce on every affected Pharo version and classify the failure: missing
30
- binding, missing selector, rename, semantic change, notice behavior, or
31
- native/tooling failure.
32
- 5. Choose the narrowest owner:
33
- - transparent shim for equivalent APIs;
34
- - an upstream PharoBackwardCompatibility backport for general APIs;
35
- - project abstraction for irreducible semantic differences;
36
- - project-local fix for library-specific behavior.
37
- 6. Verify both PharoBackwardCompatibility and the consuming project across the matrix.
38
-
39
- ## Extending PharoBackwardCompatibility
40
-
41
- - Confirm the difference is general, originates in a newer Pharo API, and
42
- affects an older supported runtime.
43
- - Put runtime code in the matching conditional package and baseline group.
44
- - Use late lookup for optional globals.
45
- - Keep backports additive when possible and test the compatibility contract,
46
- not only package loading.
47
-
48
- Use `pharo-project-load` for load-path failures and `pharo-ci-repro` for
49
- smalltalkCI or runner-specific failures.
50
-
51
- ## Report
52
-
53
- Report source surface, runtimes tested, failure classification, shim owner,
54
- packages changed, and matrix results.
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "Pharo Version Compatibility"
3
- short_description: "Use PharoBackwardCompatibility backports"
4
- default_prompt: "Use $pharo-version-compat to make this Pharo project compatible across supported Pharo versions with PharoBackwardCompatibility."