Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Changed create_export to name the resource the agent can read

Damian Legawiec24d2e3446c27
diff --git a/spree/core/app/tools/spree/agent_tools/create_export.rb b/spree/core/app/tools/spree/agent_tools/create_export.rb
index 86cde52060..3c47723bae 100644
--- a/spree/core/app/tools/spree/agent_tools/create_export.rb
+++ b/spree/core/app/tools/spree/agent_tools/create_export.rb
@@ -59,9 +59,14 @@ module Spree
# Generation is a background job, so there is no file yet. Naming
# the tool that finishes the job keeps the model from sending the
# merchant to the dashboard for something it can fetch itself.
- message: 'The export is being prepared. Read it back with get_resource ' \
- "(resource: \"exports\", id: \"#{export.prefixed_id}\"); once the file is ready " \
- 'the record carries a download_url, which is a path on this API.'
+ # Naming the MCP resource matters: a client that can read one will
+ # otherwise never learn the file is there, and the model reports a
+ # download path to a merchant instead of reading the rows itself.
+ resource_uri: "spree+export://#{export.prefixed_id}",
+ message: 'The export is being prepared. Once it is ready you can read its contents ' \
+ "from the MCP resource spree+export://#{export.prefixed_id}, or call " \
+ "get_resource (resource: \"exports\", id: \"#{export.prefixed_id}\") for its " \
+ 'status and a download_url to hand the merchant.'
}
end
diff --git a/spree/mcp/lib/spree/mcp/server.rb b/spree/mcp/lib/spree/mcp/server.rb
index 84d655cd56..e96b8384d4 100644
--- a/spree/mcp/lib/spree/mcp/server.rb
+++ b/spree/mcp/lib/spree/mcp/server.rb
@@ -25,6 +25,10 @@ module Spree
behave identically. Record arguments are prefixed ids as they appear in
search results. You are only offered the tools this credential permits,
so a tool you cannot see is one this store has not granted.
+
+ A finished export is also an MCP resource. After create_export, read
+ its contents from resources rather than reporting a download path —
+ the path is for the merchant, the resource is for you.
TEXT
class << self