Added comprehensive comment support to both coaiapy and coaiapy-mcp packages, enabling full access to Langfuse comment functionality for traces, observations, sessions, and prompts.
get_comments() - Enhanced with filtering support
- New Parameters:
object_type: Filter by object type (trace, observation, session, prompt)object_id: Filter by specific object ID (requires object_type)author_user_id: Filter by author user IDpage: Page number (starts at 1, default=1)limit: Items per page (default=50)
- Returns: JSON response with filtered comments
get_comment_by_id(comment_id) - New function
- Purpose: Retrieve specific comment by its unique ID
- Parameters:
comment_id(required) - Returns: JSON response with comment data
post_comment(text, object_type, object_id) - Enhanced with object attachment
- New Parameters:
object_type: Type of object to attach comment toobject_id: ID of the object to attach comment to
- Returns: JSON response with created comment data
coaia_fuse_comments_list() - List/filter comments
- Wraps
get_comments()with MCP-compatible error handling - Supports all filtering parameters
- Returns structured JSON response
coaia_fuse_comments_get(comment_id) - Get specific comment
- Wraps
get_comment_by_id()with MCP error handling - Returns parsed JSON or raw string with success status
coaia_fuse_comments_create(text, object_type, object_id) - Create comment
- Wraps
post_comment()with MCP error handling - Supports attaching to traces, observations, sessions, prompts
- Added 3 new tools to
TOOLSdict - Updated
__all__export list
coaia_fuse_comments_list
{
"name": "coaia_fuse_comments_list",
"description": "List comments with optional filtering by object type/ID or author",
"inputSchema": {
"object_type": "string",
"object_id": "string",
"author_user_id": "string",
"page": "integer (default: 1)",
"limit": "integer (default: 50)"
}
}coaia_fuse_comments_get
{
"name": "coaia_fuse_comments_get",
"description": "Get a specific comment by ID",
"inputSchema": {
"comment_id": "string (required)"
}
}coaia_fuse_comments_create
{
"name": "coaia_fuse_comments_create",
"description": "Create a comment attached to an object",
"inputSchema": {
"text": "string (required)",
"object_type": "string",
"object_id": "string"
}
}All implementations match Langfuse OpenAPI spec (references/openapi.yml:517-693):
✅ GET /api/public/comments - List with filters (objectType, objectId, authorUserId, page, limit)
✅ GET /api/public/comments/{commentId} - Get by ID
✅ POST /api/public/comments - Create with object attachment
from coaiapy.cofuse import get_comments, get_comment_by_id, post_comment
# List all comments for a trace
comments = get_comments(object_type="trace", object_id="trace-123")
# Get specific comment
comment = get_comment_by_id("comment-456")
# Create comment on observation
new_comment = post_comment(
text="Great performance!",
object_type="observation",
object_id="obs-789"
)# Via Claude Code or MCP-compatible client
await mcp__coaiapy__coaia_fuse_comments_list({
"object_type": "trace",
"object_id": "trace-123"
})
await mcp__coaiapy__coaia_fuse_comments_get({
"comment_id": "comment-456"
})
await mcp__coaiapy__coaia_fuse_comments_create({
"text": "Analysis complete",
"object_type": "trace",
"object_id": "trace-123"
})All comment functionality is now exposed through:
- Direct Python imports from
coaiapy.cofuse - MCP tools via
coaiapy-mcpserver - Claude Code integration (if MCP server configured)
/src/coaiapy/coaiapy/cofuse.py- Enhanced comment functions (lines 289-362)/src/coaiapy/coaiapy-mcp/coaiapy_mcp/tools.py- Added MCP tool wrappers (lines 20-32, 521-741)/src/coaiapy/coaiapy-mcp/coaiapy_mcp/server.py- Registered MCP tools (lines 223-263)
- ✅ Test comment listing with filters
- ✅ Test comment creation on traces/observations
- ✅ Test comment retrieval by ID
- ✅ Verify MCP tool exposure in Claude Code
- 🔄 Add comment functionality to CLI (optional enhancement)
- 🔄 Add comment support to pipeline templates (optional enhancement)