Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ __pycache__/
.Python
dist/
.env
.DS_Store
**/.DS_Store
.cursor/
src/devrev_mcp/scratch.txt
62 changes: 61 additions & 1 deletion src/devrev_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,21 @@ async def handle_list_tools() -> list[types.Tool]:
},
"required": ["type", "title", "applies_to_part"],
},
)
),
types.Tool(
name="update_object",
description="Update an existing issue or ticket in DevRev",
inputSchema={
"type": "object",
"properties": {
"type": {"type": "string", "enum": ["issue", "ticket"]},
"id": {"type": "string"},
"title": {"type": "string"},
"body": {"type": "string"},
},
"required": ["id", "type"],
},
),
]

@server.call_tool()
Expand Down Expand Up @@ -179,6 +193,52 @@ async def handle_call_tool(
text=f"Object created successfully: {response.json()}"
)
]
elif name == "update_object":
# Update mandatory fields
if not arguments:
raise ValueError("Missing arguments")

id = arguments.get("id")
if not id:
raise ValueError("Missing id parameter")

object_type = arguments.get("type")
if not object_type:
raise ValueError("Missing type parameter")

# Update title and body
title = arguments.get("title")
body = arguments.get("body")

# Build request payload with only the fields that have values
update_payload = {"id": id, "type": object_type}
if title:
update_payload["title"] = title
if body:
update_payload["body"] = body

# Make devrev request to update the object
response = make_devrev_request(
"works.update",
update_payload
)

# Check if the request was successful
if response.status_code != 200:
error_text = response.text
return [
types.TextContent(
type="text",
text=f"Update object failed with status {response.status_code}: {error_text}"
)
]

return [
types.TextContent(
type="text",
text=f"Object updated successfully: {id}"
)
]
else:
raise ValueError(f"Unknown tool: {name}")

Expand Down