Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

get_form_response

Retrieve specific response data from a Google Form by providing the user's email, form ID, and response ID, including detailed answers and metadata.

Instructions

Get one response from the form. Args: user_google_email (str): The user's Google email address. Required. form_id (str): The ID of the form. response_id (str): The ID of the response to retrieve. Returns: str: Response details including answers and metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
form_idYes
response_idYes
serviceYes
user_google_emailYes

Implementation Reference

  • The complete implementation of the get_form_response tool handler, including decorators for registration (@server.tool()), error handling, and service requirement. This function fetches a specific response from a Google Form using the Forms API.
    @server.tool() @handle_http_errors("get_form_response", is_read_only=True, service_type="forms") @require_google_service("forms", "forms") async def get_form_response( service, user_google_email: str, form_id: str, response_id: str ) -> str: """ Get one response from the form. Args: user_google_email (str): The user's Google email address. Required. form_id (str): The ID of the form. response_id (str): The ID of the response to retrieve. Returns: str: Response details including answers and metadata. """ logger.info(f"[get_form_response] Invoked. Email: '{user_google_email}', Form ID: {form_id}, Response ID: {response_id}") response = await asyncio.to_thread( service.forms().responses().get(formId=form_id, responseId=response_id).execute ) response_id = response.get("responseId", "Unknown") create_time = response.get("createTime", "Unknown") last_submitted_time = response.get("lastSubmittedTime", "Unknown") answers = response.get("answers", {}) answer_details = [] for question_id, answer_data in answers.items(): question_response = answer_data.get("textAnswers", {}).get("answers", []) if question_response: answer_text = ", ".join([ans.get("value", "") for ans in question_response]) answer_details.append(f" Question ID {question_id}: {answer_text}") else: answer_details.append(f" Question ID {question_id}: No answer provided") answers_text = "\n".join(answer_details) if answer_details else " No answers found" result = f"""Form Response Details for {user_google_email}: - Form ID: {form_id} - Response ID: {response_id} - Created: {create_time} - Last Submitted: {last_submitted_time} - Answers: {answers_text}""" logger.info(f"Successfully retrieved response for {user_google_email}. Response ID: {response_id}") return result
  • The @server.tool() decorator registers the get_form_response function as an MCP tool.
    @server.tool()
  • Input schema defined by function parameters and type hints, along with docstring describing args and return type.
    async def get_form_response( service, user_google_email: str, form_id: str, response_id: str ) -> str: """ Get one response from the form. Args: user_google_email (str): The user's Google email address. Required. form_id (str): The ID of the form. response_id (str): The ID of the response to retrieve. Returns: str: Response details including answers and metadata. """

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/taylorwilsdon/google_workspace_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server