Improve redMCP server operations

This commit is contained in:
Jason Thistlethwaite
2026-04-25 02:46:58 +00:00
parent 05c1a4bc97
commit d54319a5bb
14 changed files with 420 additions and 24 deletions
+46
View File
@@ -105,6 +105,52 @@ final class RedmineClient
return $this->search($query, ['issues' => '1'] + $params);
}
/**
* List Redmine projects.
*
* @param array<string,mixed> $params Standard Redmine project list params.
*
* @return array<string,mixed>
*/
public function projects(array $params = []): array
{
return $this->listProjects($params);
}
/**
* List Redmine projects.
*
* @param array<string,mixed> $params Standard Redmine project list params.
*
* @return array<string,mixed>
*/
public function listProjects(array $params = []): array
{
return $this->getJson('/projects', $params) ?? [];
}
/**
* Fetch a Redmine project by numeric id or identifier.
*
* @param array<string,mixed> $params Standard Redmine project show params.
*
* @return array<string,mixed>
*/
public function project(int|string $projectId, array $params = []): array
{
$projectId = trim((string) $projectId);
if ($projectId === '') {
throw new RuntimeException('Fetching a project requires a project id or identifier.');
}
$response = $this->getJson('/projects/' . rawurlencode($projectId), $params);
if (!is_array($response)) {
throw new RuntimeException('Could not fetch project ' . $projectId . '.');
}
return $response['project'] ?? $response;
}
/**
* Fetch a normal Redmine issue.
*