Skip to content

Conversation

@betterclever
Copy link
Contributor

Summary

Adds metadata types and helper functions for agent-callable components (tool mode). This enables components to be used as tools by AI agents via the MCP gateway.

Changes

Types (`types.ts`)

  • Added `PortBindingType`: `'credential' | 'action' | 'config'`
  • Added `bindingType` field to `ComponentPortMetadata`
  • Added `AgentToolConfig` interface with `enabled`, `toolName`, `toolDescription`
  • Added `agentTool` field to `ComponentUiMetadata`

Helper Functions (`tool-helpers.ts`)

  • `isAgentCallable(component)` - Check if component is agent-callable
  • `inferBindingType(port)` - Infer binding type from port data type
  • `getCredentialInputIds(component)` - Get IDs of credential inputs
  • `getActionInputIds(component)` - Get IDs of action inputs
  • `getToolSchema(component)` - Get JSON Schema for action inputs only
  • `getToolName(component)` - Get tool name for MCP
  • `getToolDescription(component)` - Get tool description
  • `getToolMetadata(component)` - Get complete MCP tool metadata

Tests

  • 14 tests covering all helper functions

Linear Issue

Closes ENG-95

…ents

ENG-95

- Add PortBindingType and bindingType to ComponentPortMetadata
- Add AgentToolConfig and agentTool to ComponentUiMetadata
- Create tool-helpers.ts with isAgentCallable, getToolSchema, getCredentialInputIds, getActionInputIds, getToolName, getToolDescription, getToolMetadata
- Add comprehensive tests for all helper functions (14 tests)

Signed-off-by: betterclever <[email protected]>
@betterclever betterclever force-pushed the eng-95/component-sdk-tool-mode branch from 13abde0 to 7e4d294 Compare January 15, 2026 16:39
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e4d294d12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +106 to +108
case 'json':
case 'any':
return 'object';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not force json/any ports to object in tool schema

portTypeToJsonSchemaType maps both json and any to the JSON Schema type object, but coercePrimitive in ports.ts accepts any value for these port types (strings, numbers, arrays, etc.). This makes the generated MCP inputSchema reject legitimate non-object inputs (e.g., a JSON array or string) or mislead agents about the expected shape. Consider omitting type for these ports or using a permissive schema so tool calls that pass valid non-object JSON aren’t rejected.

Useful? React with 👍 / 👎.

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.

2 participants