Skip to main content
Glama

list_work_items

Read-only

Retrieve and filter work items from a Polarion project using Lucene queries or custom SQL for precise document scope, traceability, and custom field searches.

Instructions

List and search work items in a Polarion project.

Pass a Lucene query (type:requirement, status:approved AND type:requirement, title:SRS*) or omit it for all work items. Leading wildcards (*foo*) return HTTP 400. module is not indexed — see SQL prefix below for the workaround.

Description body text is NOT indexed — for content search, scan read_document_parts (each workitem part already carries its description) or use read_document for end-to-end reading.

SQL prefix. A query starting with SQL:( runs as native SQL, unlocking patterns Lucene cannot express: module-scoped lookup, leading-wildcard LIKE, custom-field joins, and role-preserving traceability. Escape ' as '' in string literals; Polarion's REST query does not support bind parameters, so any user-supplied value substituted into a recipe must be escaped before sending. C_DESCRIPTION LIKE does NOT match (CLOB stored elsewhere; use read_document_parts for body search). On this server LIKE is rejected inside EXISTS (SELECT ...) ("Restricted SQL commands: LIKE") — keep LIKE in the top-level WHERE by using INNER JOIN as the recipes below do (works everywhere).

Schema (tables are POLARION.<name>; columns shown are the ones used for JOINs and filtering)::

WORKITEM     c_uri, c_id, c_type, c_title, c_status,
             fk_uri_module, fk_uri_project
MODULE       c_uri, c_id, c_modulefolder, fk_uri_project
PROJECT      c_uri, c_id
REL_MODULE_WORKITEM   fk_uri_module, fk_uri_workitem
CF_WORKITEM           fk_uri_workitem, c_name,
                      c_string_value | c_boolean_value |
                      c_durationtime_value | ...
STRUCT_WORKITEM_LINKEDWORKITEMS
             fk_uri_p_workitem (source / role-holder),
             fk_uri_workitem   (target), c_role

Recipe 1 — work items belonging to a document (excludes Recycle Bin and Referenced Work Items, matches read_document_parts scope)::

SQL:(SELECT item.* FROM POLARION.MODULE doc
INNER JOIN POLARION.PROJECT proj ON doc.FK_URI_PROJECT = proj.C_URI
INNER JOIN POLARION.REL_MODULE_WORKITEM rel
    ON rel.FK_URI_MODULE = doc.C_URI
INNER JOIN POLARION.WORKITEM item
    ON item.C_URI = rel.FK_URI_WORKITEM
WHERE proj.C_ID = '<project>' AND doc.C_MODULEFOLDER = '<space>'
AND doc.C_ID = '<document>'
AND item.FK_URI_MODULE = doc.C_URI)

The trailing item.FK_URI_MODULE = doc.C_URI predicate is what excludes Referenced Work Items and Recycle Bin entries; drop it to include them.

Common adjustments on Recipe 1: exclude headings with AND item.C_TYPE != 'heading' (read_document_parts returns all parts including headings), filter type with AND item.C_TYPE IN ('requirement','testcase'), or substring-match the title with AND LOWER(item.C_TITLE) LIKE '%foo%' (Lucene rejects leading *).

Recipe 2 — custom-field value search (= or LIKE)::

SQL:(SELECT item.* FROM POLARION.WORKITEM item
INNER JOIN POLARION.CF_WORKITEM cf ON cf.FK_URI_WORKITEM = item.C_URI
WHERE cf.C_NAME = '<field>'
AND cf.C_STRING_VALUE LIKE '%<value>%')

Use c_boolean_value / c_durationtime_value (etc.) for non-string customs. Rich text customs ({type: "text/plain", value: ...}) are CLOB-stored — read them via get_work_item instead.

Recipe 3 — back-traceability (work items whose role link points to <target-id>, e.g. all children of a given parent)::

SQL:(SELECT DISTINCT item.* FROM POLARION.WORKITEM item
INNER JOIN POLARION.STRUCT_WORKITEM_LINKEDWORKITEMS link
    ON link.FK_URI_P_WORKITEM = item.C_URI
INNER JOIN POLARION.WORKITEM target
    ON target.C_URI = link.FK_URI_WORKITEM
WHERE target.C_ID = '<target-id>' AND link.C_ROLE = '<role>')

fk_uri_p_workitem is the source (role-holder), fk_uri_workitem is the target. Unlike list_work_item_links(direction='back') (Lucene fallback, drops the role), this preserves c_role.

Recipe 4 — forward-traceability (work items linked from <source-id>, e.g. testcases a requirement verifies)::

SQL:(SELECT DISTINCT item.* FROM POLARION.WORKITEM item
INNER JOIN POLARION.STRUCT_WORKITEM_LINKEDWORKITEMS link
    ON link.FK_URI_WORKITEM = item.C_URI
INNER JOIN POLARION.WORKITEM source
    ON source.C_URI = link.FK_URI_P_WORKITEM
WHERE source.C_ID = '<source-id>' AND link.C_ROLE = '<role>')

Mirror of Recipe 3 with the two FK_*_WORKITEM columns swapped in both JOIN conditions.

Other patterns (testrun / timepoint / assignee joins, the LUCENE_QUERY table function) live in the Polarion SDK at polarion/sdk/doc/database/SQLQueryExamples.pdf.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesPolarion project ID.
queryNoOptional Lucene filter (e.g. 'type:requirement', 'title:SRS*') OR a 'SQL:(...)' prefix for native SQL.
page_sizeNoNumber of work items per page (1-100, default 100).
page_numberNoPage number to retrieve (1-based, default 1).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes
total_countYes
pageYes
page_sizeYes
has_moreNoTrue if more pages follow.
Behavior5/5

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

Annotations already indicate readOnlyHint=true. The description adds substantial behavioral context: query limitations (leading wildcards rejected), description body not indexed, SQL prefix escape rules, restrictions on LIKE inside EXISTS, and pagination behavior via page_size/page_number. No contradictions with annotations.

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

Conciseness3/5

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

The description is very long and includes extensive details and examples. While structured with headers (SQL prefix, recipes), it could be more concise. The first paragraph is clear, but the subsequent sections are verbose. Given the complexity, the length may be justified, but conciseness is penalized.

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 (Lucene and SQL query support), the description covers all essential aspects: query syntax, limitations, alternative tools, SQL recipes, and pagination. Since an output schema exists, return value details are not needed. The description is comprehensive for the tool's purpose.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds significant meaning beyond the schema for the 'query' parameter (Lucene vs SQL prefix, examples, warnings). For page_size and page_number, the schema already provides adequate descriptions. The description goes beyond minimal by explaining the SQL query parameter in depth.

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 clearly states it lists and searches work items in a Polarion project. It distinguishes from siblings like get_work_item, read_document, and list_work_item_links by mentioning alternative tools for specific needs (e.g., content search via read_document_parts). The verb 'list and search' combined with resource 'work items' is specific and differentiated.

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 on when to use the tool (e.g., omit query for all items, use Lucene query for field filters) and when not to (leading wildcards cause HTTP 400). It also recommends alternatives like read_document_parts for body text search and details SQL prefix usage for advanced patterns. The recipes offer concrete use cases with clear context.

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/devemberx/mcp-server-polarion'

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