Skip to content

Commit bdc11c8

Browse files
anoushkakumar321Anoushka Kumar
andauthored
Add get_vista tool for retrieving DevRev vista information (#30)
Summary Adds a new "get_vista" tool to the DevRev MCP server that allows users to retrieve vista (filtered view) information by ID. Changes Made - **New Tool**: Added "get_vista" tool with proper input schema validation - **Handler Implementation**: Complete tool handler with comprehensive error handling - **API Integration**: Uses existing `make_devrev_request` utility for consistency - **Search Enhancement**: Added "vista" namespace to search tool for better vista discovery https://app.devrev.ai/devrev/works/ISS-193339 --------- Co-authored-by: Anoushka Kumar <[email protected]>
1 parent 9c8313b commit bdc11c8

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

src/devrev_mcp/server.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ async def handle_list_tools() -> list[types.Tool]:
3030
description="Fetch the current DevRev user details. When the user specifies 'me' in the query, this tool should be called to get the user details.",
3131
inputSchema={"type": "object", "properties": {}},
3232
),
33+
types.Tool(
34+
name="get_vista",
35+
description="Retrieve information about a vista in DevRev using its ID",
36+
inputSchema={
37+
"type": "object",
38+
"properties": {
39+
"id": {
40+
"type": "string",
41+
"description": "The DevRev ID of the vista"
42+
}
43+
},
44+
"required": ["id"]
45+
},
46+
),
3347
types.Tool(
3448
name="search",
3549
description="Search DevRev using the provided query",
@@ -39,7 +53,7 @@ async def handle_list_tools() -> list[types.Tool]:
3953
"query": {"type": "string"},
4054
"namespace": {
4155
"type": "string",
42-
"enum": ["article", "issue", "ticket", "part", "dev_user", "account", "rev_org"],
56+
"enum": ["article", "issue", "ticket", "part", "dev_user", "account", "rev_org", "vista"],
4357
"description": "The namespace to search in. Use this to specify the type of object to search for."
4458
},
4559
},
@@ -439,6 +453,39 @@ async def handle_call_tool(
439453
text=f"Current DevRev user details: {response.json()}"
440454
)
441455
]
456+
457+
elif name == "get_vista":
458+
if not arguments:
459+
raise ValueError("Missing arguments")
460+
461+
id = arguments.get("id")
462+
if not id:
463+
raise ValueError("Missing id ")
464+
465+
response = make_devrev_request(
466+
"vistas.get",
467+
{
468+
"id": id
469+
}
470+
)
471+
472+
if response.status_code != 200:
473+
error_text = response.text
474+
return [
475+
types.TextContent(
476+
type="text",
477+
text=f"get_vista failed with status {response.status_code}: {error_text}"
478+
)
479+
]
480+
481+
return [
482+
types.TextContent(
483+
type="text",
484+
text=f"Vista details for '{id}':\n{response.json()}"
485+
)
486+
]
487+
488+
442489
elif name == "search":
443490
if not arguments:
444491
raise ValueError("Missing arguments")
@@ -547,6 +594,7 @@ async def handle_call_tool(
547594
text=f"Object created successfully: {response.json()}"
548595
)
549596
]
597+
550598
elif name == "update_work":
551599
if not arguments:
552600
raise ValueError("Missing arguments")

0 commit comments

Comments
 (0)