Skip to content

Generic REST Client

Varnier Gatto edited this page Oct 6, 2026 · 6 revisions

Generic REST Client & API Directory

Azure DevOps has a massive API surface consisting of thousands of endpoints. While this MCP server exposes 20+ specialized tools for common operations (Git, Work Items, Pipelines, Identities), it also provides a Generic REST Client to invoke any Azure DevOps REST API endpoint.

Caution

CRITICAL WARNING: Destructive Actions via api_call

  • Using the api_call tool with the DELETE method allows you to delete repositories, build definitions, pipelines, or work items permanently.
  • Work items deleted via api_call (with the DELETE method) do NOT go to a Recycle Bin or Trashcan. They are instantly and permanently destroyed from your Azure DevOps project. Use this tool with extreme care.

๐Ÿ› ๏ธ The Toolkit: Three Interconnected Tools

To help you discover and call arbitrary endpoints, the server includes three tools:

graph TD
    A[api_docs] -->|Finds endpoint paths & summaries| B[api_info]
    B -->|Provides schema, parameters & HTTP method| C[api_call]
    C -->|Executes the request and returns JSON| D[Azure DevOps REST API]
Loading
  1. api_docs: Performs high-speed offline searches over a local directory of 1,000+ REST API endpoints.
  2. api_info: Retrieves full parameter schemas, request bodies, and Microsoft documentation links for a specific endpoint (falls back to fetching from Microsoft servers online if missing).
  3. api_call: Makes the actual HTTP request (GET, POST, PUT, PATCH, DELETE) to the endpoint.

๐Ÿ” Step 1: Searching for an Endpoint

Suppose you want to find how to manage repository branches (known as "Refs" in Git). Run api_docs:

  • Parameters: query: "refs", area: "git"
  • Output:
    [
      {
        "method": "GET",
        "path": "/_apis/git/repositories/{repositoryId}/refs",
        "summary": "Queries the refs (branches, tags, etc.) in a Git repository."
      },
      {
        "method": "POST",
        "path": "/_apis/git/repositories/{repositoryId}/refs",
        "summary": "Creates, updates, or deletes refs (branches, tags, lock state, etc.) in a Git repository."
      }
    ]

๐Ÿ“– Step 2: Retrieving API Schema details

Once you have the path, inspect its parameters and body using api_info:

  • Parameters: method: "GET", path: "/_apis/git/repositories/{repositoryId}/refs"
  • Output:
    {
      "path": "/_apis/git/repositories/{repositoryId}/refs",
      "method": "GET",
      "description": "Queries the refs in a Git repository.",
      "parameters": {
        "repositoryId": { "type": "string", "required": true, "description": "The name or ID of the repository" },
        "filter": { "type": "string", "required": false, "description": "Filter by prefix (e.g. 'heads/')" }
      }
    }

๐Ÿš€ Step 3: Executing the API Call

Now you can invoke api_call to list all branches in a repository:

  • Parameters:
    • method: "GET"
    • path: "/_apis/git/repositories/MyRepo/refs"
    • body: {}
    • apiVersion: "7.1"
  • Output: Returns a JSON list of all matching references (e.g., refs/heads/main, refs/heads/dev).

โš ๏ธ High-Risk Examples (Deletions)

If you must delete a resource, double-check that you are targeting the correct resource ID before calling.

Example: Permanently Deleting a Work Item (No Trashcan!)

To permanently delete work item with ID 999:

  • Tool: api_call
  • Parameters:
    • method: "DELETE"
    • path: "/_apis/wit/workitems/999"
    • apiVersion: "7.1"
  • Impact: Work Item 999 is deleted instantly. It will not appear in the recycle bin and cannot be restored.

Quick Navigation Sidebar