# Requirements Document ## Introduction The Teamlandkarte MCP server currently fetches tasks from the database without including the `name` column (a short identifier). Users need to reference tasks by this short name in addition to the full ID or title. This feature adds the `name` column to all task queries and enables task lookup by name. ## Glossary - **MCP_Server**: The Teamlandkarte MCP server that exposes tools for querying tasks and capacities. - **Task**: A published task record stored in the `beschaffungstool_kmp_task_latest` database table. - **Task_Name**: The `name__c` column in the task table, a short human-readable identifier for a task. - **DBClient**: The database client protocol that defines methods for fetching tasks and capacities. - **TrinoClient**: The concrete database client implementation that queries the Trino/Presto backend. ## Requirements ### Requirement 1: Include Task Name in Task Model **User Story:** As a user, I want the task name (short ID) to be part of the task data, so that I can see and use it when browsing tasks. #### Acceptance Criteria 1. THE Task model SHALL include a `name` field of type optional string. 2. WHEN the TrinoClient fetches open tasks, THE TrinoClient SHALL select the `name__c` column from the task table and populate the Task `name` field. 3. WHEN the TrinoClient fetches a task by ID, THE TrinoClient SHALL select the `name__c` column from the task table and populate the Task `name` field. 4. WHEN the task name column value is NULL in the database, THE Task `name` field SHALL be set to None. ### Requirement 2: Display Task Name in Output **User Story:** As a user, I want to see the task name in task listings and detail views, so that I can reference tasks by their short name. #### Acceptance Criteria 1. WHEN the MCP_Server returns a list of open tasks, THE MCP_Server SHALL include the task name in the output for each task. 2. WHEN the MCP_Server returns task details, THE MCP_Server SHALL include the task name in the summary table. ### Requirement 3: Look Up Task by Name **User Story:** As a user, I want to retrieve task details by providing only the task name, so that I do not need to remember the full ID. #### Acceptance Criteria 1. THE DBClient protocol SHALL define a `get_task_by_name` method that accepts a task name string and returns a Task or None. 2. WHEN a valid published task name is provided, THE TrinoClient SHALL return the matching Task with all fields populated. 3. WHEN a task name that does not match any published task is provided, THE TrinoClient SHALL return None. 4. WHEN the user provides a task name to the get_task_details tool, THE MCP_Server SHALL resolve the task using the name and return the full task details. 5. IF the provided identifier matches neither a task ID nor a task name, THEN THE MCP_Server SHALL return a "not found" message.