Implement Google Apps Script integration

Core implementation:
- Added OAuth scopes for Apps Script API (auth/scopes.py)
- Created gappsscript module with 11 tools
- Implemented 6 core tools (list, get, create, update, run)
- Implemented 5 extended tools (deployments, processes)
- Added tool tier definitions to tool_tiers.yaml

Tools follow existing patterns:
- Async with asyncio.to_thread for API calls
- Proper decorator chain (@server.tool, @handle_http_errors, @require_google_service)
- Formatted string outputs for user readability
- Comprehensive logging

All tools tested for pattern compliance with existing codebase.
This commit is contained in:
sam-ent
2026-01-13 19:20:40 +00:00
parent 2b72c4508f
commit f5702b32b8
4 changed files with 604 additions and 0 deletions

View File

@@ -64,6 +64,16 @@ TASKS_READONLY_SCOPE = "https://www.googleapis.com/auth/tasks.readonly"
# Google Custom Search API scope
CUSTOM_SEARCH_SCOPE = "https://www.googleapis.com/auth/cse"
# Google Apps Script API scopes
SCRIPT_PROJECTS_SCOPE = "https://www.googleapis.com/auth/script.projects"
SCRIPT_PROJECTS_READONLY_SCOPE = (
"https://www.googleapis.com/auth/script.projects.readonly"
)
SCRIPT_DEPLOYMENTS_SCOPE = "https://www.googleapis.com/auth/script.deployments"
SCRIPT_DEPLOYMENTS_READONLY_SCOPE = (
"https://www.googleapis.com/auth/script.deployments.readonly"
)
# Base OAuth scopes required for user identification
BASE_SCOPES = [USERINFO_EMAIL_SCOPE, USERINFO_PROFILE_SCOPE, OPENID_SCOPE]
@@ -99,6 +109,13 @@ TASKS_SCOPES = [TASKS_SCOPE, TASKS_READONLY_SCOPE]
CUSTOM_SEARCH_SCOPES = [CUSTOM_SEARCH_SCOPE]
SCRIPT_SCOPES = [
SCRIPT_PROJECTS_SCOPE,
SCRIPT_PROJECTS_READONLY_SCOPE,
SCRIPT_DEPLOYMENTS_SCOPE,
SCRIPT_DEPLOYMENTS_READONLY_SCOPE,
]
# Tool-to-scopes mapping
TOOL_SCOPES_MAP = {
"gmail": GMAIL_SCOPES,
@@ -111,6 +128,7 @@ TOOL_SCOPES_MAP = {
"slides": SLIDES_SCOPES,
"tasks": TASKS_SCOPES,
"search": CUSTOM_SEARCH_SCOPES,
"appscript": SCRIPT_SCOPES,
}