Skip to content

Conversation

@zth
Copy link
Member

@zth zth commented Nov 2, 2025

This bootstrap a simple MCP for ReScript, through Rewatch. Initially it adds a single command diagnose, which will run quick diagnostics for a single file. Diagnostics here means that we'll run a compilation only on the single file targeted, no dependents, so it's really quick. Warnings and errors are returned to the LLM.

Supersedes #7566.

@zth zth mentioned this pull request Nov 2, 2025
.concat())
}

pub fn compiler_args_for_diagnostics(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment why this exists.

fn list_tools(&self) -> Vec<mcp_spec::tool::Tool> {
vec![Tool::new(
"diagnose",
"Quick per-file diagnostics after edits; prefer before full build; no writes; only this file.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to clarify what path is here.
I know it is a .res or .resi path, preferably the full path, but if left unspecified the LLM might call this with some other path.

let name = tool_name.to_string();
Box::pin(async move {
match name.as_str() {
"diagnose" => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems rather horrible that we need to parse the tool name ourselves. Is there no better abstraction for this?

fn instructions(&self) -> String {
"ReScript MCP server.\n\n\
Tools:\n\
- diagnose(path): Quick per-file diagnostics after edits. Prefer this before a full build.\n\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tool call does feel a bit like duplication of one of the LSP endpoints.
It makes me wonder if we should explore having an LSP client inside the MCP tool that can ask this information from the running LSP Server.

@zth zth force-pushed the experimental-mcp branch from 4e63942 to 60935ad Compare November 6, 2025 17:54
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@8001

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@8001

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@8001

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@8001

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@8001

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@8001

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@8001

commit: 60935ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants