googleapis/mcp-toolbox · error
expected allowedDataset to have at least 2 parts (project.da
Error message
expected allowedDataset to have at least 2 parts (project.dataset): %s
What it means
buildParams for bigquery-execute-sql parses each entry in allowedDatasets, which must be a fully-qualified BigQuery dataset of the form project.dataset. When a single allowed dataset has no dot (fewer than 2 parts), the tool cannot construct the SQL-guard description and returns this error at Initialize/resolveParams time.
Source
Thrown at internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go:279
// buildParams builds the tool's parameters from the source's write mode and allowed-dataset
// configuration. Empty writeMode and a nil allow-list yield the plain skeleton.
func buildParams(writeMode string, allowedDatasets []string) (parameters.Parameters, error) {
var sqlDescriptionBuilder strings.Builder
switch writeMode {
case bigqueryds.WriteModeBlocked:
sqlDescriptionBuilder.WriteString("The SQL to execute. In 'blocked' mode, only SELECT statements are allowed; other statement types will fail.")
case bigqueryds.WriteModeProtected:
sqlDescriptionBuilder.WriteString("The SQL to execute. Only SELECT statements and writes to the session's temporary dataset are allowed (e.g., `CREATE TEMP TABLE ...`).")
default: // WriteModeAllowed
sqlDescriptionBuilder.WriteString("The SQL to execute.")
}
if len(allowedDatasets) > 0 {
if len(allowedDatasets) == 1 {
datasetFQN := allowedDatasets[0]
parts := strings.Split(datasetFQN, ".")
if len(parts) < 2 {
return nil, fmt.Errorf("expected allowedDataset to have at least 2 parts (project.dataset): %s", datasetFQN)
}
datasetID := parts[1]
fmt.Fprintf(&sqlDescriptionBuilder, " The query must only access the `%s` dataset. "+
"To query a table within this dataset (e.g., `my_table`), "+
"qualify it with the dataset id (e.g., `%s.my_table`).", datasetFQN, datasetID)
} else {
datasetIDs := []string{}
for _, ds := range allowedDatasets {
datasetIDs = append(datasetIDs, fmt.Sprintf("`%s`", ds))
}
fmt.Fprintf(&sqlDescriptionBuilder, " The query must only access datasets from the following list: %s.", strings.Join(datasetIDs, ", "))
}
}
sqlParameter := parameters.NewStringParameter("sql", sqlDescriptionBuilder.String())
dryRunParameter := parameters.NewBooleanParameter(
"dry_run",
"If set to true, the query will be validated and information about the execution will be returned "+View on GitHub (pinned to 8cc6e09de2)
Solutions
- Change the allowedDatasets entry to the fully-qualified form 'project.dataset' (e.g. my-project.my_dataset).
- Check for typos such as missing dots, extra dots, or trailing whitespace in the config value.
- If using multiple datasets, ensure every list element independently satisfies project.dataset format.
- Re-run initialization; the error names the offending value to fix.
Example fix
// before (tools.yaml) allowedDatasets: - my_dataset // after allowedDatasets: - my-project.my_dataset
Defensive patterns
Strategy: validation
Validate before calling
for _, d := range cfg.AllowedDatasets {
if len(strings.Split(d, ".")) < 2 {
return fmt.Errorf("allowedDataset %q must be project.dataset", d)
}
}
// then Initialize Try / catch
if _, err := cfg.Initialize(ctx); err != nil {
if strings.Contains(err.Error(), "at least 2 parts") {
// fix allowedDatasets entries to project.dataset and re-init
}
return err
} Prevention
- Always write allowed datasets as fully-qualified project.dataset strings.
- Add config validation for allowedDatasets format before Initialize.
- Beware of trailing dots, spaces, or comma-joined values in YAML list entries.
- Document the project.dataset requirement in your config templates.
When it happens
Trigger: Configuring allowedDatasets with a bare dataset id like 'my_dataset' (or a value with only whitespace/malformed qualifiers) instead of 'my-project.my_dataset', then initializing the tool.
Common situations: Copy-pasting a dataset id from the BigQuery console without the project prefix; assuming the source's default project is applied automatically; typos like a trailing dot or comma-separated values in one list element.
Related errors
- description is required for tool %q
- invalid ipType %s
- password is provided without a username. Please provide both
- description is required for tool %q
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/6f4967a9b13f1010.
Report an issue: GitHub.