Skip to content

Fix hosted result payload handling#51

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/http-inline-result-payloads
Jun 29, 2026
Merged

Fix hosted result payload handling#51
ChiragAgg5k merged 1 commit into
mainfrom
fix/http-inline-result-payloads

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

  • Return hosted HTTP tool results inline instead of storing them in process-local result resources.
  • Keep result-resource spilling enabled by default for stdio/local usage.
  • Update server instructions and unit coverage for inline large text and image results.

Testing

  • uv run --group dev ruff check src tests
  • uv run --group dev black --check src tests
  • uv run python -m unittest discover -s tests/unit -v

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes result-payload delivery for the hosted HTTP transport by returning large results (including images) inline instead of spilling them into process-local ResultStore resources — resources that are unreachable across stateless HTTP requests. The stdio path is unchanged and continues to store results as named resources.

  • Operator gains a store_results flag; when False, _preview_or_store_result returns content immediately, bypassing threshold and resource-write logic.
  • build_operator surfaces the flag as a keyword-only argument, and build_app passes store_results=False; run_stdio keeps the default True.
  • build_instructions now emits transport-specific result-handling guidance, and new unit tests verify both the large-text and image inline-return paths.

Confidence Score: 4/5

Safe to merge; the change is well-scoped and correctly threads the new flag through all call sites without disrupting the stdio path.

The logic is straightforward and well-tested. The only concern is a minor wording issue in build_instructions where the else-branch labels all non-stdio transports as "Hosted HTTP", which could become inaccurate if new transports are added later.

The else-branch in server.py's build_instructions is worth a quick look before adding any future transport modes.

Important Files Changed

Filename Overview
src/mcp_server_appwrite/operator.py Adds store_results flag to Operator.__init__ and early-returns in _preview_or_store_result when disabled; ResultStore is still instantiated (correctly, since list_resources/read_resource still reference it).
src/mcp_server_appwrite/http_app.py Passes store_results=False to build_operator in the HTTP app, so hosted responses are returned inline.
src/mcp_server_appwrite/server.py Updates build_instructions to emit transport-specific result-handling text; adds keyword-only store_results to build_operator and forwards it to Operator. The else-branch in build_instructions applies to all non-stdio transports, which is fine given the current transport set.
tests/unit/test_operator.py Adds two new tests covering store_results=False for large text and image content; both correctly assert inline return without resource URI.
tests/unit/test_server.py Extends test_build_instructions to assert the new transport-specific result-handling strings appear in the correct instruction variants.

Reviews (1): Last reviewed commit: "Fix hosted result payload handling" | Re-trigger Greptile

Comment thread src/mcp_server_appwrite/server.py
@ChiragAgg5k ChiragAgg5k merged commit 555ced1 into main Jun 29, 2026
5 checks passed
@ChiragAgg5k ChiragAgg5k deleted the fix/http-inline-result-payloads branch June 29, 2026 07:50
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.

1 participant