Documentsagenta
Playground Tool Configuration
Playground Tool Configuration
Type
Topic
Status
Published
Created
Jul 7, 2026
Updated
Jul 7, 2026

Playground Tool Configuration#

The Playground uses a metadata-driven system to render, validate, and serialize tool definitions for LLM function-calling. The central UI component is PlaygroundTool, which wraps a JSON editor and exposes quick-edit inputs for the two most-used fields: function name and description.


Component: PlaygroundTool#

File: web/oss/src/components/Playground/Components/PlaygroundTool/index.tsx

The component holds three pieces of local state :

StatePurpose
toolStringThe full JSON string of the tool object
functionNameExtracted from toolString.function.name; bound to a dedicated Input
functionDescriptionExtracted from toolString.function.description; bound to a dedicated Input

functionName and functionDescription are synced bidirectionally with toolString via useEffect hooks : editing either quick-edit field patches the JSON, and editing the JSON raw updates both fields. The parsed tool value is forwarded upstream via editorProps.handleChange .

The raw JSON editor is SharedEditor configured in codeOnly mode, with TOOL_SCHEMA passed as the live validation schema. Deletion is handled through the usePlayground mutate hook, which splices the tool out of its parent array .


Validation Schema: TOOL_SCHEMA#

File: web/oss/src/components/Playground/Components/PlaygroundTool/assets/index.ts

TOOL_SCHEMA is a plain JSON Schema object that mirrors the OpenAI function-calling convention :

{ type: "function", function: { name, description, parameters: { type, properties, required, additionalProperties } } }

Required at root: type, function. Required inside function: name, description, parameters. Required inside parameters: type, properties, required, additionalProperties .


Metadata Generation: ToolConfiguration#

File: web/oss/src/lib/shared/variant/genericTransformer/index.ts

When the generic transformer encounters an array property whose title is "Tools" and no itemMetadata is set, it auto-generates a ToolConfiguration metadata object . This metadata describes the shape of each tool item — type, function.name, function.description, function.parameters — and drives how the transformer processes each element.

Critically, when metadata.title === "Tools", the transformed object is stored as { value: item } (i.e., the raw item value) rather than being recursively decomposed . This means tool objects pass through as-is into the variant state.

The ConfigMetadata type union (StringMetadata | NumberMetadata | ArrayMetadata | ObjectMetadata | BooleanMetadata | CompoundMetadata) covers all metadata variants used by the transformer — there is no PermissionMetadata or similar type in the schema.


Payload Construction: transformToRequestBody#

File: web/oss/src/lib/shared/variant/transformer/transformToRequestBody.ts

Tools flow into the request body as part of ag_config. The transformer builds ag_config by merging promptConfigs (extracted per prompt via extractValueByMetadata) and customConfigs . Any prompt whose llmConfig includes a tools array (typed as any[] in LLMConfig) contributes those tools to ag_config when extractValueByMetadata traverses the prompt structure.

The LLMConfig interface also exposes toolChoice?: "none" | "auto" | null — this is serialized alongside tools in the prompt config.


Known Gap: Missing Permission Field#

The TOOL_SCHEMA and the auto-generated ToolConfiguration metadata define only the four fields from the OpenAI function-calling spec (type, name, description, parameters). There is no permission field in either the UI schema or the auto-generated metadata .

If an Agent Template interface elsewhere in the system exposes a permission field on tools, the Playground UI will not render or preserve it — the field would be silently dropped during the metadata-driven round-trip unless the raw JSON editor is used directly.


Key Files at a Glance#

FileRole
PlaygroundTool/index.tsxUI component for editing a single tool
PlaygroundTool/assets/index.tsTOOL_SCHEMA JSON Schema definition
genericTransformer/index.tsAuto-generates ToolConfiguration metadata for Tools arrays
genericTransformer/types/metadata.d.tsConfigMetadata union — no permission type
transformer/transformToRequestBody.tsBuilds ag_config payload including tools
transformer/types/variant.d.tsLLMConfig interface with tools and toolChoice
Playground Tool Configuration | Dosu