{"record":{"id":"9480f5a194bec38c","repo":"googleapis/mcp-toolbox","slug":"this-tool-is-read-only-and-cannot-execute-write-qu","errorCode":null,"errorMessage":"this tool is read-only and cannot execute write queries","messagePattern":"this tool is read-only and cannot execute write queries","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/arcadedb/arcadedb.go","lineNumber":133,"sourceCode":"\treturn s.Config\n}\n\nfunc (s *Source) ArcadeDBDriver() neo4j.Driver {\n\treturn s.Driver\n}\n\nfunc (s *Source) ArcadeDBDatabase() string {\n\treturn s.Database\n}\n\nfunc (s *Source) RunCypher(ctx context.Context, cypherStr string, params map[string]any, readOnly, dryRun bool) (any, error) {\n\tcf := sourceClassifier.Classify(cypherStr)\n\tif cf.Error != nil {\n\t\treturn nil, cf.Error\n\t}\n\n\tif cf.Type == classifier.WriteQuery && readOnly {\n\t\treturn nil, fmt.Errorf(\"this tool is read-only and cannot execute write queries\")\n\t}\n\n\tif dryRun {\n\t\tcypherStr = \"EXPLAIN \" + cypherStr\n\t}\n\n\tconfig := neo4j.ExecuteQueryWithDatabase(s.ArcadeDBDatabase())\n\tresults, err := neo4j.ExecuteQuery[*neo4j.EagerResult](ctx, s.ArcadeDBDriver(), cypherStr, params,\n\t\tneo4j.EagerResultTransformer, config)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\n\tif dryRun {\n\t\tsummary := results.Summary\n\t\tplan := summary.Plan()\n\t\tif plan == nil {\n\t\t\treturn nil, fmt.Errorf(\"dry-run produced no execution plan\")","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/arcadedb/arcadedb.go#L115-L151","documentation":"RunCypher classifies the incoming Cypher statement with a query classifier and rejects it when the tool is configured as read-only (readOnly) but the statement is detected as a write (CREATE, MERGE, DELETE, etc.). This is a deliberate safety guard to prevent mutating a database through a read-only tool. The error is returned to the caller before any query is executed.","triggerScenarios":"Invoking a read-only-configured ArcadeDB tool with a Cypher write statement such as 'CREATE (n:Person)', 'MATCH (n) DELETE n', 'MERGE', 'SET', or 'DETACH DELETE' — anything the classifier labels WriteQuery.","commonSituations":"Users pointing an LLM agent at a read-only tool but asking it to insert/update data; classifier false positives on statements containing write keywords inside strings; misconfigured tool intended to be writable but declared read-only.","solutions":["Remove write clauses from the query, or split reads and writes across tools with the correct readOnly settings.","If writes are intended, reconfigure/redeploy the tool with readOnly disabled.","Rephrase the query so read-only keywords appear only as literals if the classifier misfires.","Verify cf.Type via the classifier output if you believe the classification is wrong."],"exampleFix":"// before: write against a read-only tool\nCREATE (n:Person {name: 'Ada'}) RETURN n\n// after: read-only compatible query\nMATCH (n:Person {name: 'Ada'}) RETURN n","handlingStrategy":"validation","validationCode":"var writeRe = regexp.MustCompile(`(?i)\\\\b(create|merge|delete|detach\\\\s+delete|set|remove)\\\\b`)\nif readOnly && writeRe.MatchString(cypher) {\n    return errors.New(\"query contains write clauses; read-only tool\")\n}","typeGuard":null,"tryCatchPattern":"if err := runCypher(ctx, q); err != nil {\n    if strings.Contains(err.Error(), \"read-only\") {\n        // surface a user-facing 'this tool cannot modify data' message\n        return ErrReadOnlyViolation\n    }\n    return err\n}","preventionTips":["Split read and write operations into separate tools with correct readOnly flags.","Sanitize/validate LLM-generated Cypher before passing it to read-only tools.","Keep write keywords out of string literals to avoid classifier false positives.","Document readOnly behavior in the tool description so agents avoid write attempts."],"tags":["arcadedb","cypher","read-only","security"],"backgroundTag":"write-query-rejected","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}