Skip to content

fix: mark Advisor tools as project-scoped - #102

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/advisor-project-context
Aug 13, 2026
Merged

fix: mark Advisor tools as project-scoped#102
ChiragAgg5k merged 1 commit into
mainfrom
fix/advisor-project-context

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Advisor SDK methods call project resources under /reports, but the hidden catalog classified the service as context=console. Hosted calls therefore did not require a project and defaulted to the Console project.

before: advisor_list_reports context=console
 after: advisor_list_reports context=project -> requires project_id

Add Advisor to the project-context policy, update hosted guidance, and assert that every generated Advisor tool carries project context.

This corrects MCP targeting, but production still has a separate downstream blocker: a fresh OAuth token advertises project:reports.read, while targeted /reports calls return missing scopes (["reports.read"]). That scope translation must be fixed in Appwrite Cloud before Advisor succeeds end to end.

Verification

uv run --group dev ruff check src tests
uv run --group dev black --check src tests
uv run --group dev pyright
uv run python -m unittest discover -s tests/unit -v  # 234 passed

Live production probe: users_list succeeded across all six accessible projects; advisor_list_reports reached each project's regional endpoint but consistently returned the downstream reports.read scope error.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR marks generated Advisor tools as project-scoped so hosted OAuth calls require an explicit target project.

  • Adds Advisor to the shared project-context service policy.
  • Updates hosted tool guidance to identify Advisor as project-scoped.
  • Adds a unit test covering generated Advisor tool context.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified in the changed behavior.

Advisor now follows the established project-context policy in hosted mode, while API-key mode continues using its preconfigured project client without target-context enforcement.

Important Files Changed

Filename Overview
src/mcp_server_appwrite/catalog_policy.py Adds Advisor to the existing project-context policy, correctly applying target-project enforcement in hosted mode.
src/mcp_server_appwrite/operator.py Updates project-selection guidance to include Advisor without changing runtime behavior.
src/mcp_server_appwrite/server.py Updates server instructions to tell hosted callers that Advisor requires a target project.
tests/unit/test_server.py Adds coverage asserting that every generated OAuth Advisor tool carries project context.

Fix All in Greploop

Reviews (1): Last reviewed commit: "fix: mark Advisor tools as project-scope..." | Re-trigger Greptile

@ChiragAgg5k
ChiragAgg5k merged commit 1ed798a into main Aug 13, 2026
5 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/advisor-project-context branch August 13, 2026 08:33
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