set_publish_settings
Update Google Forms publish settings to control template publishing and authentication requirements for viewing or submission.
Instructions
Updates the publish settings of a form.
Args:
user_google_email (str): The user's Google email address. Required.
form_id (str): The ID of the form to update publish settings for.
publish_as_template (bool): Whether to publish as a template. Defaults to False.
require_authentication (bool): Whether to require authentication to view/submit. Defaults to False.
Returns:
str: Confirmation message of the successful publish settings update.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| form_id | Yes | ||
| publish_as_template | No | ||
| require_authentication | No | ||
| service | Yes | ||
| user_google_email | Yes |
Implementation Reference
- gforms/forms_tools.py:124-159 (handler)The main handler function for the 'set_publish_settings' MCP tool. It is decorated with @server.tool() for registration, updates Google Form publish settings via the Forms API, handles authentication, and returns a confirmation message.@server.tool() @handle_http_errors("set_publish_settings", service_type="forms") @require_google_service("forms", "forms") async def set_publish_settings( service, user_google_email: str, form_id: str, publish_as_template: bool = False, require_authentication: bool = False ) -> str: """ Updates the publish settings of a form. Args: user_google_email (str): The user's Google email address. Required. form_id (str): The ID of the form to update publish settings for. publish_as_template (bool): Whether to publish as a template. Defaults to False. require_authentication (bool): Whether to require authentication to view/submit. Defaults to False. Returns: str: Confirmation message of the successful publish settings update. """ logger.info(f"[set_publish_settings] Invoked. Email: '{user_google_email}', Form ID: {form_id}") settings_body = { "publishAsTemplate": publish_as_template, "requireAuthentication": require_authentication } await asyncio.to_thread( service.forms().setPublishSettings(formId=form_id, body=settings_body).execute ) confirmation_message = f"Successfully updated publish settings for form {form_id} for {user_google_email}. Publish as template: {publish_as_template}, Require authentication: {require_authentication}" logger.info(f"Publish settings updated successfully for {user_google_email}. Form ID: {form_id}") return confirmation_message