Skip to main content
Glama

get_work_item_template

Retrieve detailed information about a specific work item template from Azure DevOps, including default field values and pre-populated data, to understand and utilize templates effectively.

Instructions

Gets detailed information about a specific work item template. Use this tool when you need to: - View default field values in a template - Understand what a template pre-populates in a work item - Get complete details about a template Args: team_context: Dictionary containing team information with keys: project: Project name (Optional if project_id is provided) project_id: Project ID (Optional if project is provided) team: Team name (Optional if team_id is provided) team_id: Team ID (Optional if team is provided) template_id: The ID of the template Returns: Detailed information about the template including default field values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team_contextYes
template_idYes

Implementation Reference

  • The main handler function for the 'get_work_item_template' MCP tool. It handles input validation via type hints and docstring schema, retrieves the work item client, calls the implementation helper, and manages errors.
    @mcp.tool() def get_work_item_template(team_context: dict, template_id: str) -> str: """ Gets detailed information about a specific work item template. Use this tool when you need to: - View default field values in a template - Understand what a template pre-populates in a work item - Get complete details about a template Args: team_context: Dictionary containing team information with keys: project: Project name (Optional if project_id is provided) project_id: Project ID (Optional if project is provided) team: Team name (Optional if team_id is provided) team_id: Team ID (Optional if team is provided) template_id: The ID of the template Returns: Detailed information about the template including default field values """ try: wit_client = get_work_item_client() return _get_work_item_template_impl( team_context, template_id, wit_client) except AzureDevOpsClientError as e: return f"Error: {str(e)}"
  • Core helper function that performs the actual Azure DevOps API call to retrieve the template details and formats the output using _format_work_item_template.
    def _get_work_item_template_impl(team_context: dict, template_id: str, wit_client: WorkItemTrackingClient) -> str: """Implementation of work item template detail retrieval.""" try: team_ctx = _create_team_context(team_context) template = wit_client.get_template(team_ctx, template_id) if not template: return f"Template with ID '{template_id}' not found." return _format_work_item_template(template) except Exception as e: return f"Error retrieving template '{template_id}': {str(e)}"
  • Helper function to format the retrieved template data into a readable markdown structure including name, description, type, ID, and default field values.
    def _format_work_item_template(template): """Format work item template data for display.""" result = [f"# Template: {template.name}"] for attr in ["description", "work_item_type_name", "id"]: value = getattr(template, attr, None) if value: result.append(f"{attr.replace('_', ' ').capitalize()}: {value}") fields = getattr(template, "fields", None) if fields: result.append("\n## Default Field Values") for field, value in fields.items(): result.append(f"- {field}: {value}") return "\n".join(result)
  • Registration aggregator for work items tools that invokes templates.register_tools(mcp), leading to the registration of the get_work_item_template tool via its @mcp.tool() decorator.
    templates.register_tools(mcp)
  • The register_tools function in the templates module where the get_work_item_template tool is defined and registered using the @mcp.tool() decorator.
    def register_tools(mcp) -> None: """ Register work item templates tools with the MCP server. Args: mcp: The FastMCP server instance """ @mcp.tool() def get_work_item_templates( team_context: dict, work_item_type: Optional[str] ) -> str: """ Gets a list of all work item templates for a team. Use this tool when you need to: - Find available templates for creating work items - Get template IDs for use in other operations - Filter templates by work item type Args: team_context: Dictionary containing team information with keys: project: Project name (Optional if project_id is provided) project_id: Project ID (Optional if project is provided) team: Team name (Optional if team_id is provided) team_id: Team ID (Optional if team is provided) work_item_type: Optional work item type name to filter templates Returns: A formatted table of all templates with names, work item types, and descriptions """ try: wit_client = get_work_item_client() return _get_work_item_templates_impl( team_context, work_item_type, wit_client) except AzureDevOpsClientError as e: return f"Error: {str(e)}" @mcp.tool() def get_work_item_template(team_context: dict, template_id: str) -> str: """ Gets detailed information about a specific work item template. Use this tool when you need to: - View default field values in a template - Understand what a template pre-populates in a work item - Get complete details about a template Args: team_context: Dictionary containing team information with keys: project: Project name (Optional if project_id is provided) project_id: Project ID (Optional if project is provided) team: Team name (Optional if team_id is provided) team_id: Team ID (Optional if team is provided) template_id: The ID of the template Returns: Detailed information about the template including default field values """ try: wit_client = get_work_item_client() return _get_work_item_template_impl( team_context, template_id, wit_client) except AzureDevOpsClientError as e: return f"Error: {str(e)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vortiago/mcp-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server