Skip to content

Commit a1194c5

Browse files
Copilothotlong
andauthored
feat(service-ai): add runtime metadata tool handlers with registerMetadataTools()
Implement actual ToolHandler functions for all 6 metadata management tools in packages/services/service-ai/src/tools/metadata-tools.ts: - create_object: Validates snake_case name, checks duplicates, registers via IMetadataService - add_field: Validates object exists, field doesn't exist, merges into object definition - modify_field: Validates object/field exist, applies partial patch - delete_field: Validates object/field exist, removes field from definition - list_objects: Returns summaries with optional filter and field inclusion - describe_object: Returns full schema with field array and feature flags registerMetadataTools() follows same pattern as registerDataTools(). 29 unit tests covering handler execution, validation, error paths, and full create→add→modify→delete→describe lifecycle. Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/ff28e788-07bc-4fd3-99b2-9f6db7352c67 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent c0f2017 commit a1194c5

6 files changed

Lines changed: 1293 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
### Added
1818
- **Metadata Management Tools & Skill (Tool→Skill→Agent)** — Added 6 platform built-in AI
1919
tools for metadata operations (`create_object`, `add_field`, `modify_field`, `delete_field`,
20-
`list_objects`, `describe_object`) in `packages/spec/src/ai/metadata-tools.zod.ts`. Each
21-
tool has structured JSON Schema parameters, output schema, permission controls, and
22-
confirmation requirements for destructive operations. Aggregated into `metadata_management`
23-
skill in `metadata-skill.zod.ts` with trigger phrases and programmatic activation conditions.
24-
Fully testable with 26 unit tests covering individual tool definitions, schema validation,
25-
aggregate exports, and skill structure.
20+
`list_objects`, `describe_object`):
21+
- **Protocol definitions** in `packages/spec/src/ai/metadata-tools.zod.ts` and
22+
`metadata-skill.zod.ts` — Zod-validated tool schemas with JSON Schema parameters,
23+
output schemas, permission controls, and `metadata_management` skill aggregation.
24+
- **Runtime implementation** in `packages/services/service-ai/src/tools/metadata-tools.ts`
25+
Actual `ToolHandler` functions that call `IMetadataService` CRUD methods (`register`,
26+
`getObject`, `listObjects`) to create objects, add/modify/delete fields, and inspect
27+
schemas. Registered via `registerMetadataTools(registry, { metadataService })`.
28+
- 55 unit tests across spec (26) and service-ai (29) covering schema validation, handler
29+
execution, error handling, full create→add→modify→delete lifecycle, and edge cases.
2630
- **Agent Skills — `skills/` directory (agentskills.io)** — Created `skills/` folder at
2731
repository root following the [agentskills.io specification](https://agentskills.io/specification).
2832
Five expert-knowledge skills with hand-written `SKILL.md` files and `references/` quick-lookup

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ Objects now declare `namespace: 'sys'` and a short `name` (e.g., `name: 'user'`)
663663
- [ ] Agent runtime — execute AI agents defined in spec schemas
664664
- [x] Tool registry — connect agents to ObjectQL operations, APIs, and workflows (initial implementation in `service-ai`)
665665
- [x] Conversation management — persistent chat with context windows (initial implementation in `service-ai`)
666-
- [x] Metadata management tools — 6 built-in tools (`create_object`, `add_field`, `modify_field`, `delete_field`, `list_objects`, `describe_object`) with structured parameters, permissions, and `metadata_management` skill
666+
- [x] Metadata management tools — 6 built-in tools (`create_object`, `add_field`, `modify_field`, `delete_field`, `list_objects`, `describe_object`) with protocol definitions (`@objectstack/spec`) and runtime handlers (`@objectstack/service-ai`) registered via `registerMetadataTools()`
667667

668668
### 7.3 RAG Pipeline
669669

0 commit comments

Comments
 (0)