Skip to content

Conversation

@gRedHeadphone
Copy link
Contributor

Description

Unmarshal object_details json string into map to make response have nested json in spannerlisttables instead of nested JSON string

PR Checklist

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #1838

@gRedHeadphone gRedHeadphone requested a review from a team as a code owner November 7, 2025 05:47
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@gRedHeadphone
Copy link
Contributor Author

agent readability of output comparision

adk agent

queries = [
    "can you list all table name simple?",
    "can you get me detailed info about Products?",
]

main branch

A1
Here are the table names in your Spanner database: Account, AccountTransferAccount, Accounts, Customers, Follows, Knows, Person, Persons, and Products.

A2
Here are the detailed schema information for the table Products:

Schema Name: (empty string)
Object Name: Products
Object Type: BASE TABLE

Columns:

  • ProductID (INT64, NOT NULL)
  • ProductName (STRING(255), NULLABLE)
  • Description (STRING(MAX), NULLABLE)
  • Price (NUMERIC, NULLABLE)
  • Category (STRING(100), NULLABLE)
  • Manufacturer (STRING(100), NULLABLE)
  • UnitsInStock (INT64, NULLABLE)

Constraints:

  • CK_IS_NOT_NULL_Products_ProductID (CHECK, ProductID IS NOT NULL)
  • PK_Products (PRIMARY KEY, PRIMARY KEY (ProductID))

Indexes:

  • PRIMARY_KEY (PRIMARY_KEY, UNIQUE, index key column: ProductID)

nested json

A1
Here are the table names in your database: Account, AccountTransferAccount, Accounts, Customers, Follows, Knows, Person, Persons, and Products.

A2
Here are the details for the Products table:

  • Columns:
    • ProductID (INT64, NOT NULL)
    • ProductName (STRING(255), NULLABLE)
    • Description (STRING(MAX), NULLABLE)
    • Price (NUMERIC, NULLABLE)
    • Category (STRING(100), NULLABLE)
    • Manufacturer (STRING(100), NULLABLE)
    • UnitsInStock (INT64, NULLABLE)
  • Constraints:
    • PK_Products: PRIMARY KEY (ProductID)
    • CK_IS_NOT_NULL_Products_ProductID: CHECK (ProductID IS NOT NULL)
  • Indexes:
    • PRIMARY_KEY: UNIQUE INDEX on ProductID

gemini cli

main branch

can you list all table names in spanner

✦ The table names in Spanner are: Account, AccountTransferAccount, Accounts, Customers, Follows,
Knows, Person, Persons, Products.

can you get me detailed info about Products?

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ list_tables (mcptoolbox MCP Server) {"table_names":"Products","output_format":"detailed"} │
│ │
│ {"object_details":"{"schema_name":"","object_name":"Products","object_type":"BAS │
│ E │
│ TABLE","columns":[{"column_name":"ProductID","data_type":"INT64","ordinal_posit │
│ ion":1,"is_not_nullable":true,"column_default":null},{"column_name":"ProductName", │
│ "data_type":"STRING(255)","ordinal_position":2,"is_not_nullable":false,"column_def │
│ ault":null},{"column_name":"Description","data_type":"STRING(MAX)","ordinal_posit │
│ ion":3,"is_not_nullable":false,"column_default":null},{"column_name":"Price","dat │
│ a_type":"NUMERIC","ordinal_position":4,"is_not_nullable":false,"column_default":nu │
│ ll},{"column_name":"Category","data_type":"STRING(100)","ordinal_position":5,"is │
not_nullable":false,"column_default":null},{"column_name":"Manufacturer","data_typ │
│ e":"STRING(100)","ordinal_position":6,"is_not_nullable":false,"column_default":nul │
│ l},{"column_name":"UnitsInStock","data_type":"INT64","ordinal_position":7,"is_no │
│ t_nullable":false,"column_default":null}],"constraints":[{"constraint_name":"CK_IS

│ NOT_NULL_Products_ProductID","constraint_type":"CHECK","constraint_definition":"Pro │
│ ductID IS NOT │
│ NULL","constraint_columns":[""],"foreign_key_referenced_table":null,"foreign_key_re │
│ ferenced_columns":[""]},{"constraint_name":"PK_Products","constraint_type":"PRIMA │
│ RY KEY","constraint_definition":"PRIMARY KEY │
│ (ProductID)","constraint_columns":["ProductID"],"foreign_key_referenced_table":null, │
│ "foreign_key_referenced_columns":[""]}],"indexes":[{"index_name":"PRIMARY_KEY"," │
│ index_type":"PRIMARY_KEY","is_unique":true,"is_null_filtered":false,"interleaved_in │
│ _table":"","index_key_columns":[{"column_name":"ProductID","ordering":"ASC"}], │
│ "storing_columns":[]}]}","object_name":"Products","schema_name":""} │
╰────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ The detailed information for the Products table is as follows:

Table Name: Products
Object Type: BASE TABLE

Columns:

  • ProductID: INT64, Not Nullable, Ordinal Position: 1
  • ProductName: STRING(255), Nullable, Ordinal Position: 2
  • Description: STRING(MAX), Nullable, Ordinal Position: 3
  • Price: NUMERIC, Nullable, Ordinal Position: 4
  • Category: STRING(100), Nullable, Ordinal Position: 5
  • Manufacturer: STRING(100), Nullable, Ordinal Position: 6
  • UnitsInStock: INT64, Nullable, Ordinal Position: 7

Constraints:

  • CK_IS_NOT_NULL_Products_ProductID: CHECK constraint, definition: ProductID IS NOT NULL
  • PK_Products: PRIMARY KEY constraint, definition: PRIMARY KEY (ProductID), columns: ProductID

Indexes:

  • PRIMARY_KEY: PRIMARY KEY type, unique: true, null filtered: false, key columns: ProductID
    (ascending)

nested json

can you list all table names in spanner

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ list_tables (mcptoolbox MCP Server) {"output_format":"simple"} │
│ │
│ {"object_details":{"name":"Account"},"object_name":"Account","schema_name":""} │
│ {"object_details":{"name":"AccountTransferAccount"},"object_name":"AccountTransferAccount", │
│ "schema_name":""} │
│ {"object_details":{"name":"Accounts"},"object_name":"Accounts","schema_name":""} │
│ {"object_details":{"name":"Customers"},"object_name":"Customers","schema_name":""} │
│ {"object_details":{"name":"Follows"},"object_name":"Follows","schema_name":""} │
│ {"object_details":{"name":"Knows"},"object_name":"Knows","schema_name":""} │
│ {"object_details":{"name":"Person"},"object_name":"Person","schema_name":""} │
│ {"object_details":{"name":"Persons"},"object_name":"Persons","schema_name":""} │
│ {"object_details":{"name":"Products"},"object_name":"Products","schema_name":""} │
╰────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ - Account

  • AccountTransferAccount
  • Accounts
  • Customers
  • Follows
  • Knows
  • Person
  • Persons
  • Products

can you get me detailed info about Products?

╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ list_tables (mcptoolbox MCP Server) {"table_names":"Products","output_format":"detailed"} │
│ │
│ {"object_details":{"columns":[{"column_default":null,"column_name":"ProductID","data_type": │
│ "INT64","is_not_nullable":true,"ordinal_position":1},{"column_default":null,"column_name":" │
│ ProductName","data_type":"STRING(255)","is_not_nullable":false,"ordinal_position":2},{"colu │
│ mn_default":null,"column_name":"Description","data_type":"STRING(MAX)","is_not_nullable":fa │
│ lse,"ordinal_position":3},{"column_default":null,"column_name":"Price","data_type":"NUMERIC │
│ ","is_not_nullable":false,"ordinal_position":4},{"column_default":null,"column_name":"Categ │
│ ory","data_type":"STRING(100)","is_not_nullable":false,"ordinal_position":5},{"column_defau │
│ lt":null,"column_name":"Manufacturer","data_type":"STRING(100)","is_not_nullable":false,"or │
│ dinal_position":6},{"column_default":null,"column_name":"UnitsInStock","data_type":"INT64", │
│ "is_not_nullable":false,"ordinal_position":7}],"constraints":[{"constraint_columns":[""],"c │
│ onstraint_definition":"ProductID IS NOT │
│ NULL","constraint_name":"CK_IS_NOT_NULL_Products_ProductID","constraint_type":"CHECK","fore │
│ ign_key_referenced_columns":[""],"foreign_key_referenced_table":null},{"constraint_columns" │
│ :["ProductID"],"constraint_definition":"PRIMARY KEY │
│ (ProductID)","constraint_name":"PK_Products","constraint_type":"PRIMARY │
│ KEY","foreign_key_referenced_columns":[""],"foreign_key_referenced_table":null}],"indexes": │
│ [{"index_key_columns":[{"column_name":"ProductID","ordering":"ASC"}],"index_name":"PRIMARY_ │
│ KEY","index_type":"PRIMARY_KEY","interleaved_in_table":"","is_null_filtered":false,"is_uniq │
│ ue":true,"storing_columns":[]}],"object_name":"Products","object_type":"BASE │
│ TABLE","schema_name":""},"object_name":"Products","schema_name":""} │
╰────────────────────────────────────────────────────────────────────────────────────────────────╯

1 {
2 "object_details": {
3 "columns": [
4 {
5 "column_default": null,
6 "column_name": "ProductID",
7 "data_type": "INT64",
8 "is_not_nullable": true,
9 "ordinal_position": 1
10 },
11 {
12 "column_default": null,
13 "column_name": "ProductName",
14 "data_type": "STRING(255)",
15 "is_not_nullable": false,
16 "ordinal_position": 2
17 },
18 {
19 "column_default": null,
20 "column_name": "Description",
21 "data_type": "STRING(MAX)",
22 "is_not_nullable": false,
23 "ordinal_position": 3
24 },
25 {
26 "column_default": null,
27 "column_name": "Price",
28 "data_type": "NUMERIC",
29 "is_not_nullable": false,
30 "ordinal_position": 4
31 },
32 {
33 "column_default": null,
34 "column_name": "Category",
35 "data_type": "STRING(100)",
36 "is_not_nullable": false,
37 "ordinal_position": 5
38 },
39 {
40 "column_default": null,
41 "column_name": "Manufacturer",
42 "data_type": "STRING(100)",
43 "is_not_nullable": false,
44 "ordinal_position": 6
45 },
46 {
47 "column_default": null,
48 "column_name": "UnitsInStock",
49 "data_type": "INT64",
50 "is_not_nullable": false,
51 "ordinal_position": 7
52 }
53 ],
54 "constraints": [
55 {
56 "constraint_columns": [
57 ""
58 ],
59 "constraint_definition": "ProductID IS NOT NULL",
60 "constraint_name": "CK_IS_NOT_NULL_Products_ProductID",
61 "constraint_type": "CHECK",
62 "foreign_key_referenced_columns": [
63 ""
64 ],
65 "foreign_key_referenced_table": null
66 },
67 {
68 "constraint_columns": [
69 "ProductID"
70 ],
71 "constraint_definition": "PRIMARY KEY (ProductID)",
72 "constraint_name": "PK_Products",
73 "constraint_type": "PRIMARY KEY",
74 "foreign_key_referenced_columns": [
75 ""
76 ],
77 "foreign_key_referenced_table": null
78 }
79 ],
80 "indexes": [
81 {
82 "index_key_columns": [
83 {
84 "column_name": "ProductID",
85 "ordering": "ASC"
86 }
87 ],
88 "index_name": "PRIMARY_KEY",
89 "index_type": "PRIMARY_KEY",
90 "interleaved_in_table": "",
91 "is_null_filtered": false,
92 "is_unique": true,
93 "storing_columns": []
94 }
95 ],
96 "object_name": "Products",
97 "object_type": "BASE TABLE",
98 "schema_name": ""
99 },
100 "object_name": "Products",
101 "schema_name": ""
102 }
The Products table has the following columns:

  • ProductID: INT64, not nullable, primary key
  • ProductName: STRING(255)
  • Description: STRING(MAX)
  • Price: NUMERIC
  • Category: STRING(100)
  • Manufacturer: STRING(100)
  • UnitsInStock: INT64

It has a primary key constraint on ProductID and a check constraint ensuring ProductID is not
null. There is also a primary key index on ProductID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested JSON in spanner-list-tables output is as string

3 participants