Skip to main content
Glama

get_polarion_work_items

Search and discover work items like requirements and tasks in Polarion projects using filters to explore project scope and identify relevant items.

Instructions

<purpose>Discover and search work items (requirements, tasks, etc.) in a Polarion project</purpose>

<when_to_use>
- MAIN DISCOVERY TOOL: Use this to explore project contents
- When searching for specific topics (e.g., "HMI", "requirements")
- When you need to understand project scope and available work items
- BEFORE using get_polarion_work_item() for detailed info
</when_to_use>

<workflow_position>
STEP 1: After get_polarion_projects(), use this to explore project contents
STEP 2: Analyze results to identify relevant work items
STEP 3: Use get_polarion_work_item() for detailed information on specific items
OPTIONAL: Use get_polarion_document() if user provides specific space/document names
</workflow_position>

<parameters>
- project_id: Required. Get from get_polarion_projects() results
- limit: Number of items (default 10). Use 30-50 for comprehensive searches
- query: POWERFUL filter. Examples:
  * "HMI" - finds HMI-related items
  * "type:requirement" - only requirements
  * "HMI AND type:requirement" - HMI requirements
  * "title:system" - items with "system" in title
</parameters>

<examples>
- Finding HMI requirements: query="HMI AND type:requirement", limit=30
- Project overview: query="", limit=50
- Security items: query="security OR safety", limit=20
- All requirements: query="type:requirement", limit=100
</examples>

<output>
Minimal fields (id, title, type, description) - use get_polarion_work_item() for full details
Contains rich information including work item relationships and metadata
</output>

<critical_note>
This tool often contains all the information you need. Work items include:
- Requirements, specifications, tasks
- Relationships between items
- Project structure and organization
Check results thoroughly before seeking additional tools
</critical_note>

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
project_idYes
queryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler decorated with @mcp.tool(). Defines input schema via type hints and docstring. Delegates to PolarionClient.get_work_items() and formats JSON response with status, work_items list, and guidance.
    @mcp.tool()
    def get_polarion_work_items(project_id: str, limit: int = 10, query: str = "") -> str:
        """
        <purpose>Discover and search work items (requirements, tasks, etc.) in a Polarion project</purpose>
        
        <when_to_use>
        - MAIN DISCOVERY TOOL: Use this to explore project contents
        - When searching for specific topics (e.g., "HMI", "requirements")
        - When you need to understand project scope and available work items
        - BEFORE using get_polarion_work_item() for detailed info
        </when_to_use>
        
        <workflow_position>
        STEP 1: After get_polarion_projects(), use this to explore project contents
        STEP 2: Analyze results to identify relevant work items
        STEP 3: Use get_polarion_work_item() for detailed information on specific items
        OPTIONAL: Use get_polarion_document() if user provides specific space/document names
        </workflow_position>
        
        <parameters>
        - project_id: Required. Get from get_polarion_projects() results
        - limit: Number of items (default 10). Use 30-50 for comprehensive searches
        - query: POWERFUL filter. Examples:
          * "HMI" - finds HMI-related items
          * "type:requirement" - only requirements
          * "HMI AND type:requirement" - HMI requirements
          * "title:system" - items with "system" in title
        </parameters>
        
        <examples>
        - Finding HMI requirements: query="HMI AND type:requirement", limit=30
        - Project overview: query="", limit=50
        - Security items: query="security OR safety", limit=20
        - All requirements: query="type:requirement", limit=100
        </examples>
        
        <output>
        Minimal fields (id, title, type, description) - use get_polarion_work_item() for full details
        Contains rich information including work item relationships and metadata
        </output>
        
        <critical_note>
        This tool often contains all the information you need. Work items include:
        - Requirements, specifications, tasks
        - Relationships between items
        - Project structure and organization
        Check results thoroughly before seeking additional tools
        </critical_note>
        """
        logger.info(f"Fetching {limit} work items from project {project_id}")
        work_items = polarion_client.get_work_items(project_id, limit, query)
        if work_items:
            return json.dumps({
                "status": "success",
                "message": f"Successfully fetched {len(work_items)} work items from project {project_id}",
                "work_items": work_items,
                "count": len(work_items),
                "project_id": project_id,
                "next_steps": "Use get_polarion_work_item() for detailed info on specific items"
            }, indent=2)
        return json.dumps({
            "status": "error",
            "message": f"Failed to fetch work items from project {project_id}. Check token, project ID, or permissions."
        }, indent=2)
  • Core helper method in PolarionClient class that performs the actual REST API GET request to Polarion's /workitems endpoint, handles authentication, parameters, response parsing, and error handling.
    def get_work_items(self, project_id: str, limit: int = 10, query: str = "") -> List[Dict]:
        """Fetch work items (minimal fields). Parameters: project_id, limit, optional query."""
        try:
            self._ensure_token()
            api_url = f"{POLARION_BASE_URL}/rest/v1/projects/{project_id}/workitems"
            params = {
                'fields[workitems]': WORK_ITEM_MIN_FIELDS,
                'page[size]': limit
            }
            if query:
                params['query'] = query
            response = self.session.get(api_url, params=params, headers=self._headers(), timeout=REQUEST_TIMEOUT_SECONDS)
            self._handle_api_response(response, f"fetch work items from project {project_id}")
            data = response.json()
            work_items = (data.get('data') or [])[:limit]
            logger.info(f"Fetched {len(work_items)} work items from {project_id}")
            return work_items
        except Exception as e:
            logger.error(f"Failed to fetch work items from {project_id}: {e}")
            return []
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and excels by disclosing behavioral traits beyond basic functionality. It explains output characteristics ('Minimal fields', 'Contains rich information'), workflow integration ('STEP 1: After get_polarion_projects()'), and practical usage notes ('This tool often contains all the information you need', 'Check results thoroughly before seeking additional tools'), providing comprehensive context for the agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with labeled sections (<purpose>, <when_to_use>, etc.), making it easy to parse. While comprehensive, it is appropriately sized with each sentence adding value (e.g., examples, workflow steps). A slight deduction as it could be more front-loaded, but overall efficient and organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (3 parameters, no annotations, but with output schema), the description is complete. It covers purpose, usage, parameters, examples, output details, and critical notes, providing all necessary context for an agent to select and invoke the tool correctly. The output schema existence reduces the need to explain return values, and the description fills all other gaps effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, but the description compensates fully with a detailed <parameters> section. It explains each parameter's role (e.g., 'project_id: Required. Get from get_polarion_projects() results'), provides usage tips ('limit: Use 30-50 for comprehensive searches'), and gives concrete query examples with syntax explanations, adding significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the purpose as 'Discover and search work items (requirements, tasks, etc.) in a Polarion project' with a clear verb+resource combination. It distinguishes from sibling tools like get_polarion_work_item() for detailed info and get_polarion_document() for specific documents, providing clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance with sections like <when_to_use> listing specific scenarios (e.g., 'MAIN DISCOVERY TOOL', 'searching for specific topics'), <workflow_position> detailing steps and alternatives (e.g., 'BEFORE using get_polarion_work_item()'), and <critical_note> advising when to use this tool versus others. It clearly defines when and how to use this tool relative to siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Sdunga1/MCP-Polarion'

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