Google classroom

Learn how to use Google classroom with Composio

Overview

SLUG: GOOGLE_CLASSROOM

Description

Google Classroom is a free web service developed by Google for schools that aims to simplify creating, distributing, and grading assignments

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to https://www.googleapis.com/auth/classroom.courses,https://www.googleapis.com/auth/classroom.courses.readonly,https://www.googleapis.com/auth/classroom.coursework.students,https://www.googleapis.com/auth/classroom.courseworkmaterials,https://www.googleapis.com/auth/classroom.topics,https://www.googleapis.com/auth/classroom.rosters,https://www.googleapis.com/auth/classroom.rosters.readonly,https://www.googleapis.com/auth/classroom.announcements,https://www.googleapis.com/auth/classroom.course-work.readonly,https://www.googleapis.com/auth/classroom.student-submissions.students.readonly,https://www.googleapis.com/auth/classroom.student-submissions.me.readonly,https://www.googleapis.com/auth/classroom.coursework.me,https://www.googleapis.com/auth/classroom.announcements.readonly,https://www.googleapis.com/auth/classroom.courseworkmaterials.readonly,https://www.googleapis.com/auth/classroom.topics.readonly,https://www.googleapis.com/auth/classroom.addons.student,https://www.googleapis.com/auth/classroom.addons.teacher,https://www.googleapis.com/auth/classroom.guardianlinks.students.readonly,https://www.googleapis.com/auth/classroom.guardianlinks.students,https://www.googleapis.com/auth/classroom.profile.emails,https://www.googleapis.com/auth/classroom.profile.photos,https://www.googleapis.com/auth/classroom.guardianlinks.me.readonly,https://www.googleapis.com/auth/classroom.push-notifications,https://www.googleapis.com/auth/userinfo.profile,https://www.googleapis.com/auth/userinfo.email
token
stringRequired

Connecting to Google classroom

Create an auth config

Use the dashboard to create an auth config for the Google classroom toolkit. This allows you to connect multiple Google classroom accounts to Composio for agents to use.

1

Select App

Navigate to [Google classroom](https://platform.composio.dev/marketplace/Google classroom).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Google classroom Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4google_classroom_auth_config_id = "ac_YOUR_GOOGLE_CLASSROOM_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Google classroom: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, google_classroom_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Using Bearer Token

1from composio import Composio
2
3# Auth config ID created above
4google_classroom_auth_config_id = "ac_YOUR_GOOGLE_CLASSROOM_CONFIG_ID"
5
6# UUID from database/application
7user_id = "0000-0000-0000"
8
9composio = Composio()
10
11
12def authenticate_toolkit(user_id: str, auth_config_id: str):
13 # Replace this with a method to retrieve the Bearer Token from the user.
14 bearer_token = input("[!] Enter bearer token")
15 connection_request = composio.connected_accounts.initiate(
16 user_id=user_id,
17 auth_config_id=auth_config_id,
18 config={"auth_scheme": "BEARER_TOKEN", "val": bearer_token}
19 )
20 print(f"Successfully connected Google classroom for user {user_id}")
21 print(f"Connection status: {connection_request.status}")
22
23 return connection_request.id
24
25
26connection_id = authenticate_toolkit(user_id, google_classroom_auth_config_id)
27
28# You can verify the connection using:
29connected_account = composio.connected_accounts.get(connection_id)
30print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Google classroom toolkit’s playground](https://app.composio.dev/app/Google classroom)

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["GOOGLE_CLASSROOM"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: List CourseWorkMaterials

Description

Tool to list courseworkmaterials in a course. use after confirming a valid courseid; supports pagination and ordering.

Action Parameters

courseId
stringRequired
orderBy
string
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Courses

Description

Tool to list all courses accessible to the authenticated user. use when you need a paginated list of courses.

Action Parameters

courseStates
array
pageSize
integer
pageToken
string
studentId
string
teacherId
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get CourseWork

Description

Tool to get details of a specific coursework. use when detailed information about a particular assignment is needed.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List CourseWork

Description

Tool to list coursework in a course. use after verifying courseid.

Action Parameters

courseId
stringRequired
courseWorkStates
array
orderBy
string
pageSize
integer
pageToken
string
previewVersion
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Coursework Material

Description

Tool to get a coursework material. use when you need to retrieve details of a specific coursework material by course and material id.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List CourseWorkMaterials

Description

Tool to list course work materials in a course. use when you need to retrieve and paginate materials for a given courseid.

Action Parameters

courseId
stringRequired
orderBy
string
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Announcement

Description

Tool to create an announcement in a course. use after confirming the course id is valid.

Action Parameters

assigneeMode
string
courseId
stringRequired
individualStudentsOptions
object
materials
array
scheduledTime
string
state
string
text
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Announcement

Description

Tool to delete an announcement. use after confirming the announcement id.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Announcement

Description

Tool to get an announcement. use when you need to fetch an announcement by course and announcement id.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Announcements

Description

Tool to list announcements in a course. use after you have the course id to page through announcements.

Action Parameters

courseId
stringRequired
orderBy
string
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Patch Announcement

Description

Tool to update fields of an announcement. use when you need to modify specific details of an existing announcement after confirming which fields to update.

Action Parameters

assigneeMode
string
courseId
stringRequired
id
stringRequired
individualStudentsOptions
object
materials
array
scheduledTime
string
state
string
text
string
updateMask
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Course

Description

Tool to create a new course. use when a teacher needs to establish a classroom course before enrollment.

Action Parameters

courseState
string
description
string
descriptionHeading
string
name
stringRequired
ownerId
stringRequired
room
string
section
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Course

Description

Tool to delete a course. use when you need to remove a course after confirming the course id.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Course

Description

Tool to get details for a specific course. use when you need full course information by id.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Patch Course

Description

Tool to update one or more fields of a classroom course. use after retrieving course details and confirming fields to update.

Action Parameters

courseState
string
description
string
descriptionHeading
string
id
stringRequired
name
string
ownerId
string
room
string
section
string
updateMask
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Student Guardians

Description

Tool to list guardians of a student in a course. use when you need to retrieve and paginate guardians for a given student in a course.

Action Parameters

courseId
stringRequired
pageSize
integer
pageToken
string
studentId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Course Students

Description

Tool to list students in a course. use after you have the course id to page through enrolled students.

Action Parameters

courseId
stringRequired
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Teacher

Description

Tool to get teacher enrollment. use when you need to retrieve a specific teacher in a course by courseid and userid.

Action Parameters

courseId
stringRequired
fields
string
quotaUser
string
userId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Course Teachers

Description

Tool to list teachers in a course. use after you have the course id to page through enrolled teachers.

Action Parameters

courseId
stringRequired
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Course Topic

Description

Tool to create a course topic. use when you need to organize course content into named sections.

Action Parameters

courseId
stringRequired
name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Course Topic

Description

Tool to delete a course topic. use when you need to remove a topic from a course after confirming the course and topic ids.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Course Topic

Description

Tool to get a course topic. use when you need to retrieve details of a specific course topic by id after confirming the course and topic ids.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Course Topics

Description

Tool to list topics in a course. use when you have confirmed the courseid and need to retrieve its topics.

Action Parameters

courseId
stringRequired
pageSize
integer
pageToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Patch Course Topic

Description

Tool to update fields of a course topic. use when you need to rename a topic after confirming its current details.

Action Parameters

courseId
stringRequired
id
stringRequired
name
string
updateMask
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create CourseWork

Description

Tool to create a coursework item in a course. use when you need to assign an assignment or question to students immediately or on a schedule.

Action Parameters

assignment
object
courseId
stringRequired
description
string
dueDate
object
dueTime
object
materials
array
maxPoints
number
multipleChoiceQuestion
object
scheduledTime
string
shortAnswerQuestion
object
state
stringDefaults to PUBLISHED
submissionModificationMode
string
title
stringRequired
topicId
string
workType
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete CourseWork

Description

Tool to delete a specific coursework. use when you need to remove a coursework item from a course after confirming the ids.

Action Parameters

courseId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Course Work Material

Description

Tool to create course work material. use when adding resources or notes to a course.

Action Parameters

assigneeMode
string
associatedWithDeveloper
boolean
courseId
stringRequired
description
string
individualStudentsOptions
object
materials
array
scheduledTime
string
state
stringRequired
title
string
topicId
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Patch Coursework

Description

Tool to update fields of a coursework. use when you need to modify specific details of an existing coursework after confirming which fields to update.

Action Parameters

courseId
stringRequired
description
string
dueDate
object
dueTime
object
id
stringRequired
maxPoints
number
scheduledTime
string
title
string
topicId
string
updateMask
stringRequired
workType
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Student Submissions

Description

Tool to list student submissions for a specific coursework. use when you need to fetch or paginate student submissions by course and coursework, optionally filtering by user, state, or timeliness.

Action Parameters

courseId
stringRequired
courseWorkId
stringRequired
late
string
pageSize
integer
pageToken
string
states
array
userId
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reclaim Student Submission

Description

Tool to reclaim a student submission for editing. use after a student requests to edit their turned-in submission, resetting its state to created.

Action Parameters

courseId
stringRequired
courseWorkId
stringRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Invitation

Description

Tool to create an invitation for a user to a course. use after confirming the course id is valid.

Action Parameters

courseId
stringRequired
role
stringRequired
userId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired