You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add kbagent semantic-layer schema --type … to fetch the JSON schema of semantic object types, porting the get_semantic_schema MCP tool.
MCP source (keboola-mcp-server @ agent-v1.60.0)
Tool: src/keboola_mcp_server/tools/semantic/tools.py (get_semantic_schema) — for each requested type calls metastore_client.get_schema(type).
Client: clients/metastore.pyget_schema(object_type, version=None) → GET api/v1/schema/{object_type} (optional /{version}). Returns the raw JSON Schema the server emits, wrapped as {semantic_type, schema}.
Important: the schema is server-fetched, not static Pydantic — so it always matches the deployed metastore version.
What kbagent already has
metastore_client.pyMetastoreClient uses the same base URL (metastore.{suffix}) and auth (X-StorageApi-Token), but exposes only repository CRUD verbs (list_items/get_item/post_item/put_item/delete_item). No get_schema, no /api/v1/schema/ call.
The --type notion already exists (semantic-layer show --type, search-context --type) via TYPE_ALIAS in semantic_layer_service.py — reuse for the singular→wire mapping (add model).
Proposed command
kbagent semantic-layer schema --project P --type metric[,dataset,relationship,constraint,glossary,model] [--all]
Implementation sketch (3-layer)
L3MetastoreClient.get_schema(item_type) -> dict → GET /api/v1/schema/{item_type}.
L2SemanticLayerService.get_schema(alias, types) → reuse TYPE_ALIAS, fan out per type (the service already uses ThreadPoolExecutor, cf. _fetch_children_parallel), return {project, schemas: [{type, schema}]}.
L1 thin command; --json raw schemas; human = per-type panel/tree.
Effort: S
Acceptance criteria
kbagent semantic-layer schema --type metric,dataset returns each type's JSON schema.
Fetch live — do NOT hand-roll static schemas (they would drift the moment the metastore evolves). Mirror upstream.
--project is required (schema fetched from that project's stack) even though schemas are stack-global — acceptable, matches all other semantic-layer subcommands.
Optional: support ?version= (upstream has it; low cost).
Part of #390.
Summary
Add
kbagent semantic-layer schema --type …to fetch the JSON schema of semantic object types, porting theget_semantic_schemaMCP tool.MCP source (
keboola-mcp-server@agent-v1.60.0)src/keboola_mcp_server/tools/semantic/tools.py(get_semantic_schema) — for each requested type callsmetastore_client.get_schema(type).clients/metastore.pyget_schema(object_type, version=None)→GET api/v1/schema/{object_type}(optional/{version}). Returns the raw JSON Schema the server emits, wrapped as{semantic_type, schema}.What kbagent already has
metastore_client.pyMetastoreClientuses the same base URL (metastore.{suffix}) and auth (X-StorageApi-Token), but exposes only repository CRUD verbs (list_items/get_item/post_item/put_item/delete_item). Noget_schema, no/api/v1/schema/call.--typenotion already exists (semantic-layer show --type,search-context --type) viaTYPE_ALIASinsemantic_layer_service.py— reuse for the singular→wire mapping (addmodel).Proposed command
Implementation sketch (3-layer)
MetastoreClient.get_schema(item_type) -> dict→GET /api/v1/schema/{item_type}.SemanticLayerService.get_schema(alias, types)→ reuseTYPE_ALIAS, fan out per type (the service already usesThreadPoolExecutor, cf._fetch_children_parallel), return{project, schemas: [{type, schema}]}.--jsonraw schemas; human = per-type panel/tree.Effort: S
Acceptance criteria
kbagent semantic-layer schema --type metric,datasetreturns each type's JSON schema.--jsonemits{project, schemas:[{type, schema}]}.Risks / open questions
--projectis required (schema fetched from that project's stack) even though schemas are stack-global — acceptable, matches all othersemantic-layersubcommands.?version=(upstream has it; low cost).