Tool: create_session
Create a Dataproc Session in a Google Cloud project
The following sample demonstrate how to use curl to invoke the create_session MCP tool.
| Curl Request |
|---|
curl --location 'https://dataproc.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "create_session", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
A request to create a session.
CreateSessionRequest
| JSON representation |
|---|
{
"parent": string,
"session": {
object ( |
| Fields | |
|---|---|
parent |
Required. The parent resource where this session will be created. |
session |
Required. The interactive session to create. |
sessionId |
Required. The ID to use for the session, which becomes the final component of the session's resource name. This value must be 4-63 characters. Valid characters are /[a-z][0-9]-/. |
requestId |
Optional. A unique ID used to identify the request. If the service receives two CreateSessionRequestss with the same ID, the second request is ignored, and the first Recommendation: Set this value to a UUID. The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters. |
Session
| JSON representation |
|---|
{ "name": string, "uuid": string, "createTime": string, "runtimeInfo": { object ( |
| Fields | |
|---|---|
name |
Identifier. The resource name of the session. |
uuid |
Output only. A session UUID (Unique Universal Identifier). The service generates this value when it creates the session. |
createTime |
Output only. The time when the session was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
runtimeInfo |
Output only. Runtime information about session execution. |
state |
Output only. A state of the session. |
stateMessage |
Output only. Session state details, such as the failure description if the state is |
stateTime |
Output only. The time when the session entered the current state. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
creator |
Output only. The email address of the user who created the session. |
labels |
Optional. The labels to associate with the session. Label keys must contain 1 to 63 characters, and must conform to RFC 1035. Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035. No more than 32 labels can be associated with a session. An object containing a list of |
runtimeConfig |
Optional. Runtime configuration for the session execution. |
environmentConfig |
Optional. Environment configuration for the session execution. |
user |
Optional. The email address of the user who owns the session. |
stateHistory[] |
Output only. Historical state information for the session. |
sessionTemplate |
Optional. The session template used by the session. Only resource names, including project ID and location, are valid. Example: * The template must be in the same project and Dataproc region as the session. |
Union field session_config. The session configuration. session_config can be only one of the following: |
|
jupyterSession |
Optional. Jupyter session config. |
sparkConnectSession |
Optional. Spark connect session config. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
JupyterConfig
| JSON representation |
|---|
{
"kernel": enum ( |
| Fields | |
|---|---|
kernel |
Optional. Kernel |
displayName |
Optional. Display name, shown in the Jupyter kernelspec card. |
RuntimeInfo
| JSON representation |
|---|
{ "endpoints": { string: string, ... }, "outputUri": string, "diagnosticOutputUri": string, "approximateUsage": { object ( |
| Fields | |
|---|---|
endpoints |
Output only. Map of remote access endpoints (such as web interfaces and APIs) to their URIs. An object containing a list of |
outputUri |
Output only. A URI pointing to the location of the stdout and stderr of the workload. |
diagnosticOutputUri |
Output only. A URI pointing to the location of the diagnostics tarball. |
approximateUsage |
Output only. Approximate workload resource usage, calculated when the workload completes (see Dataproc Serverless pricing). Note: This metric calculation may change in the future, for example, to capture cumulative workload resource consumption during workload execution (see the Dataproc Serverless release notes for announcements, changes, fixes and other Dataproc developments). |
currentUsage |
Output only. Snapshot of current workload resource usage. |
propertiesInfo |
Optional. Properties of the workload organized by origin. |
cohortInfo |
Output only. Information about the cohort that the workload belongs to. |
EndpointsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
UsageMetrics
| JSON representation |
|---|
{ "milliDcuSeconds": string, "shuffleStorageGbSeconds": string, "milliAcceleratorSeconds": string, "acceleratorType": string, "updateTime": string } |
| Fields | |
|---|---|
milliDcuSeconds |
Optional. DCU (Dataproc Compute Units) usage in ( |
shuffleStorageGbSeconds |
Optional. Shuffle storage usage in ( |
milliAcceleratorSeconds |
Optional. [DEPRECATED] Accelerator usage in ( |
acceleratorType |
Optional. [DEPRECATED] Accelerator type being used, if any |
updateTime |
Optional. The timestamp of the usage metrics. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
UsageSnapshot
| JSON representation |
|---|
{ "milliDcu": string, "shuffleStorageGb": string, "milliDcuPremium": string, "shuffleStorageGbPremium": string, "milliAccelerator": string, "acceleratorType": string, "snapshotTime": string } |
| Fields | |
|---|---|
milliDcu |
Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see Dataproc Serverless pricing). |
shuffleStorageGb |
Optional. Shuffle Storage in gigabytes (GB). (see Dataproc Serverless pricing) |
milliDcuPremium |
Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at premium tier (see Dataproc Serverless pricing). |
shuffleStorageGbPremium |
Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see Dataproc Serverless pricing) |
milliAccelerator |
Optional. Milli (one-thousandth) accelerator. (see Dataproc Serverless pricing) |
acceleratorType |
Optional. Accelerator type being used, if any |
snapshotTime |
Optional. The timestamp of the usage snapshot. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
PropertiesInfo
| JSON representation |
|---|
{
"autotuningProperties": {
string: {
object ( |
| Fields | |
|---|---|
autotuningProperties |
Output only. Properties set by autotuning engine. An object containing a list of |
AutotuningPropertiesEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
ValueInfo
| JSON representation |
|---|
{ "value": string, "annotation": string, "overriddenValue": string } |
| Fields | |
|---|---|
value |
Property value. |
annotation |
Annotation, comment or explanation why the property was set. |
overriddenValue |
Optional. Value which was replaced by the corresponding component. |
CohortInfo
| JSON representation |
|---|
{
"cohort": string,
"cohortSource": enum ( |
| Fields | |
|---|---|
cohort |
Output only. Final cohort that was used to tune the workload. |
cohortSource |
Output only. Source of the cohort. |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
RuntimeConfig
| JSON representation |
|---|
{ "version": string, "containerImage": string, "properties": { string: string, ... }, "repositoryConfig": { object ( |
| Fields | |
|---|---|
version |
Optional. Version of the batch runtime. |
containerImage |
Optional. Optional custom container image for the job runtime environment. If not specified, a default container image will be used. |
properties |
Optional. A mapping of property names to values, which are used to configure workload execution. An object containing a list of |
repositoryConfig |
Optional. Dependency repository configuration. |
autotuningConfig |
Optional. Autotuning configuration of the workload. |
cohort |
Optional. Cohort identifier. Identifies families of the workloads that have the same shape, for example, daily ETL jobs. |
PropertiesEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
RepositoryConfig
| JSON representation |
|---|
{
"pypiRepositoryConfig": {
object ( |
| Fields | |
|---|---|
pypiRepositoryConfig |
Optional. Configuration for PyPi repository. |
PyPiRepositoryConfig
| JSON representation |
|---|
{ "pypiRepository": string } |
| Fields | |
|---|---|
pypiRepository |
Optional. The PyPi repository address. Note: This field is not available for batch workloads. |
AutotuningConfig
| JSON representation |
|---|
{
"scenarios": [
enum ( |
| Fields | |
|---|---|
scenarios[] |
Optional. Scenarios for which tunings are applied. |
EnvironmentConfig
| JSON representation |
|---|
{ "executionConfig": { object ( |
| Fields | |
|---|---|
executionConfig |
Optional. Execution configuration for a workload. |
peripheralsConfig |
Optional. Peripherals configuration that workload has access to. |
ExecutionConfig
| JSON representation |
|---|
{ "serviceAccount": string, "networkTags": [ string ], "kmsKey": string, "idleTtl": string, "ttl": string, "stagingBucket": string, "authenticationConfig": { object ( |
| Fields | |
|---|---|
serviceAccount |
Optional. Service account that used to execute workload. |
networkTags[] |
Optional. Tags used for network traffic control. |
kmsKey |
Optional. The Cloud KMS key to use for encryption. |
idleTtl |
Optional. Applies to sessions only. The duration to keep the session alive while it's idling. Exceeding this threshold causes the session to terminate. This field cannot be set on a batch workload. Minimum value is 10 minutes; maximum value is 14 days (see JSON representation of Duration). Defaults to 1 hour if not set. If both |
ttl |
Optional. The duration after which the workload will be terminated, specified as the JSON representation for Duration. When the workload exceeds this duration, it will be unconditionally terminated without waiting for ongoing work to finish. If |
stagingBucket |
Optional. A Cloud Storage bucket used to stage workload dependencies, config files, and store workload output and other ephemeral data, such as Spark history files. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location according to the region where your workload is running, and then create and manage project-level, per-location staging and temporary buckets. This field requires a Cloud Storage bucket name, not a |
authenticationConfig |
Optional. Authentication configuration used to set the default identity for the workload execution. The config specifies the type of identity (service account or user) that will be used by workloads to access resources on the project(s). |
Union field network. Network configuration for workload execution. network can be only one of the following: |
|
networkUri |
Optional. Network URI to connect workload to. |
subnetworkUri |
Optional. Subnetwork URI to connect workload to. |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
AuthenticationConfig
| JSON representation |
|---|
{
"userWorkloadAuthenticationType": enum ( |
| Fields | |
|---|---|
userWorkloadAuthenticationType |
Optional. Authentication type for the user workload running in containers. |
PeripheralsConfig
| JSON representation |
|---|
{
"metastoreService": string,
"sparkHistoryServerConfig": {
object ( |
| Fields | |
|---|---|
metastoreService |
Optional. Resource name of an existing Dataproc Metastore service. Example:
|
sparkHistoryServerConfig |
Optional. The Spark History Server configuration for the workload. |
SparkHistoryServerConfig
| JSON representation |
|---|
{ "dataprocCluster": string } |
| Fields | |
|---|---|
dataprocCluster |
Optional. Resource name of an existing Dataproc Cluster to act as a Spark History Server for the workload. Example:
|
SessionStateHistory
| JSON representation |
|---|
{
"state": enum ( |
| Fields | |
|---|---|
state |
Output only. The state of the session at this point in the session history. |
stateMessage |
Output only. Details about the state at this point in the session history. |
stateStartTime |
Output only. The time when the session entered the historical state. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
Output Schema
This resource represents a long-running operation that is the result of a network API call.
Operation
| JSON representation |
|---|
{ "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // Union field |
| Fields | |
|---|---|
name |
The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the |
metadata |
Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. An object containing fields of an arbitrary type. An additional field |
done |
If the value is |
Union field result. The operation result, which can be either an error or a valid response. If done == false, neither error nor response is set. If done == true, exactly one of error or response can be set. Some services might not provide the result. result can be only one of the following: |
|
error |
The error result of the operation in case of failure or cancellation. |
response |
The normal, successful response of the operation. If the original method returns no data on success, such as An object containing fields of an arbitrary type. An additional field |
Any
| JSON representation |
|---|
{ "typeUrl": string, "value": string } |
| Fields | |
|---|---|
typeUrl |
Identifies the type of the serialized Protobuf message with a URI reference consisting of a prefix ending in a slash and the fully-qualified type name. Example: type.googleapis.com/google.protobuf.StringValue This string must contain at least one The prefix is arbitrary and Protobuf implementations are expected to simply strip off everything up to and including the last All type URL strings must be legal URI references with the additional restriction (for the text format) that the content of the reference must consist only of alphanumeric characters, percent-encoded escapes, and characters in the following set (not including the outer backticks): In the original design of |
value |
Holds a Protobuf serialization of the type described by type_url. A base64-encoded string. |
Status
| JSON representation |
|---|
{ "code": integer, "message": string, "details": [ { "@type": string, field1: ..., ... } ] } |
| Fields | |
|---|---|
code |
The status code, which should be an enum value of |
message |
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the |
details[] |
A list of messages that carry the error details. There is a common set of message types for APIs to use. An object containing fields of an arbitrary type. An additional field |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ❌ | Open World Hint: ❌