Skip to content

Conversation

@VincentMolinie
Copy link
Member

@VincentMolinie VincentMolinie commented Dec 9, 2025

Summary

This PR completes the MCP server implementation with full action support and CRUD operations.

New Tools

  • create - Create records in a collection
  • update - Update existing records by ID
  • delete - Delete one or more records by IDs
  • listRelated - Query HasMany and BelongsToMany relations
  • describeCollection - Get collection schema including fields, relations, and actions
  • getActionForm - Load action form fields with dynamic form support
  • executeAction - Execute actions with file upload/download support

Action Features

  • Dynamic forms: Pass values parameter to trigger change hooks and discover dependent fields
  • Multi-page forms: Layout includes page structure with navigation labels
  • File upload: Accept { name, mimeType, contentBase64 } as field values
  • File download: Return files up to 5MB as base64 (larger files return FileTooLarge)
  • All result types: Success, Webhook, Redirect, File
  • Widget metadata: Full widget configuration (placeholder, min/max, format, etc.)

Changes to agent-client

  • Add queryWithFileSupport() to http-requester for binary responses
  • Add executeWithFileSupport() to Action class

Test plan

  • All existing tests pass (367 MCP server tests, 156 agent-client tests)
  • Build passes for both packages
  • Manual testing with real Forest Admin environment

🤖 Generated with Claude Code

@qltysh
Copy link

qltysh bot commented Dec 9, 2025

17 new issues

Tool Category Rule Count
qlty Structure Function with many parameters (count = 4): declareCreateTool 8
qlty Structure Function with high complexity (count = 12): queryWithFileSupport 5
qlty Duplication Found 15 lines of similar code in 2 locations (mass = 79) 2
qlty Structure Complex binary expression 1
qlty Structure High total complexity (count = 68) 1

@qltysh
Copy link

qltysh bot commented Dec 9, 2025

Qlty

Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@VincentMolinie VincentMolinie force-pushed the feat/forest-mcp/main branch 2 times, most recently from 5a9a1e7 to 5dbcbd5 Compare December 16, 2025 10:52
@VincentMolinie VincentMolinie force-pushed the feat/forest-mc/has-many branch 2 times, most recently from a650103 to ef695fc Compare December 18, 2025 14:50
Base automatically changed from feat/forest-mcp/main to main December 18, 2025 15:00
@VincentMolinie VincentMolinie force-pushed the feat/forest-mc/has-many branch 2 times, most recently from 4bb3277 to 13bbc97 Compare December 18, 2025 15:15
@Scra3 Scra3 force-pushed the feat/forest-mc/has-many branch from 13bbc97 to bdb1840 Compare December 18, 2025 16:28
@Scra3
Copy link
Member

Scra3 commented Dec 18, 2025

Auto code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

1 similar comment
@Scra3
Copy link
Member

Scra3 commented Dec 19, 2025

Auto code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

alban bertolini and others added 12 commits December 19, 2025 17:22
- Add `create` tool to create records in a collection
- Add `update` tool to update existing records
- Add `delete` tool to delete one or more records
- Add integration tests for all three tools (43 new tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…port

- Rename tool from getHasMany to listRelated for clarity
- Rename has-many.ts to list-related.ts
- Add enableCount option with totalCount support (parallel execution)
- Change response format to always return { records: [...] }
- Add count() method to Relation class in agent-client
- Fix typo in error message for invalid relations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update ForestField relationship type to include 'BelongsToMany'
- Include BelongsToMany relations in error messages alongside HasMany
- Add test for BelongsToMany relations in available relations error
- Fix existing error tests with missing schema mocks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Change description from "(hasMany)" to "one-to-many or many-to-many"
- Simplify activity log label from "list hasMany relation" to "list relation"
- Update related tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add describeCollection tool to expose collection schema to AI
- Add capabilities() method to Collection class in agent-client
- Returns fields with types, operators, and relations
- Falls back to forest schema if capabilities route unavailable
- Fix integration test description mismatch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add instruction to use this tool first before querying data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add getActionForm tool to load action form fields
- Add executeAction tool to execute actions with form values
- Update describeCollection to include actions info
- Update agent-caller to support action endpoints
- Update activity-logs-creator for action activity logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…onForm

- Add optional `values` parameter to trigger change hooks for dynamic forms
- Return layout information including page structure for multi-page forms
- Enhance field response with description, enums, options, and isReadOnly
- Enable progressive field discovery by calling getActionForm with values

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
executeAction improvements:
- Handle all result types: Success, Webhook, Redirect
- Return invalidatedRelations for cache invalidation
- Document that File downloads are not supported via MCP

getActionForm improvements:
- Add full widget metadata (placeholder, min, max, step, etc.)
- Include widget type name for UI hints
- Support file picker constraints (extensions, size, count)
- Include reference field for Collection type
- Add search configuration for dynamic dropdowns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
File upload:
- Accept file values as { name, mimeType, contentBase64 }
- Convert to data URI format expected by the agent
- Support both single files and file arrays (FileList)

File download:
- Add queryWithFileSupport to agent-client http-requester
- Add executeWithFileSupport method to Action class
- Handle binary responses with Content-Disposition header
- Return file content as base64 (max 5MB)
- Return FileTooLarge error for files exceeding limit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@Scra3 Scra3 force-pushed the feat/forest-mc/has-many branch from 11f5da7 to f909651 Compare December 20, 2025 17:18
@Scra3 Scra3 changed the title feat(forest mcp): add has many tool feat(mcp-server): complete action support with files, dynamic forms, and CRUD operations Dec 20, 2025
Code fixes:
- Fix potential TypeError on error.message in list-related.ts
- Add SAFE_ARGUMENTS_FOR_LOGGING for all new tools
- Fix html type (null -> undefined) in execute-action.ts
- Make activity log creation non-blocking (no longer fails operations)
- Add logging for silent deserialization fallback in http-requester

New tests:
- Add comprehensive tests for execute-action tool (file upload/download)
- Add tests for get-action-form tool (widget metadata, layouts)
- Add tests for queryWithFileSupport in http-requester
- Add tests for executeWithFileSupport in action.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@Scra3
Copy link
Member

Scra3 commented Dec 20, 2025

Auto code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

alban bertolini and others added 2 commits December 20, 2025 21:44
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@Scra3
Copy link
Member

Scra3 commented Dec 21, 2025

Auto code review

No issues found. Checked for bugs in action form handling, dynamic forms, file upload/download support, and HTTP response handling.

🤖 Generated with Claude Code


- If this code review was useful, please react with 👍. Otherwise, react with 👎.

alban bertolini and others added 3 commits December 21, 2025 12:40
- Remove complex Boolean/Enum field detection from hints
- Keep only canExecute and requiredFieldsMissing in hints
- Update tool description to explain dynamic form behavior
- Fix activity-logs-creator tests to match non-throwing behavior
- Add example multi-page dynamic form action in dvd.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Export ActivityLogAction type from activity-logs-creator
- Use typed action parameter instead of string
- Update list.ts to use ActivityLogAction type
- Update tests with proper type assertions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove createActivityLog call from getActionForm tool
- Remove forestServerUrl parameter from declareGetActionFormTool
- Remove getActionForm from ActivityLogAction type
- Remove activity logging tests for getActionForm

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

3 participants