feat: add wiki create, edit, and delete tools #15

Merged
jmiller merged 1 commits from feature/wiki-crud-tools into main 2026-06-19 01:03:30 +00:00
2 changed files with 57 additions and 1 deletions
+4 -1
View File
@@ -250,12 +250,15 @@ If `connection` is omitted, the `defaultConnection` is used.
| `gitea_webhooks_list` | List webhooks for a repository |
| `gitea_webhook_create` | Create a webhook |
### Wiki (2 tools)
### Wiki (5 tools)
| Tool | Description |
|------|-------------|
| `gitea_wiki_pages_list` | List wiki pages |
| `gitea_wiki_page_get` | Get a wiki page |
| `gitea_wiki_page_create` | Create a new wiki page |
| `gitea_wiki_page_edit` | Edit an existing wiki page |
| `gitea_wiki_page_delete` | Delete a wiki page |
### Notifications (2 tools)
+53
View File
@@ -1059,6 +1059,59 @@ server.tool(
async ({ owner, repo, page_name, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/wiki/page/${page_name}`)),
);
server.tool(
'gitea_wiki_page_create',
'Create a new wiki page',
{
...OwnerRepo,
title: z.string().describe('Page title'),
content: z.string().describe('Page content (markdown)'),
message: z.string().optional().describe('Commit message for the wiki change'),
...ConnectionParam,
},
async ({ owner, repo, title, content, message, connection }) => {
const body: Record<string, unknown> = {
title,
content_base64: Buffer.from(content).toString('base64'),
};
if (message) body.message = message;
return formatResponse(await clientFor(connection).post(`/repos/${owner}/${repo}/wiki/new`, body));
},
);
server.tool(
'gitea_wiki_page_edit',
'Edit an existing wiki page',
{
...OwnerRepo,
page_name: z.string().describe('Current page name/slug'),
content: z.string().describe('New page content (markdown)'),
title: z.string().optional().describe('New page title (to rename)'),
message: z.string().optional().describe('Commit message for the wiki change'),
...ConnectionParam,
},
async ({ owner, repo, page_name, content, title, message, connection }) => {
const body: Record<string, unknown> = {
content_base64: Buffer.from(content).toString('base64'),
};
if (title) body.title = title;
if (message) body.message = message;
return formatResponse(await clientFor(connection).patch(`/repos/${owner}/${repo}/wiki/page/${page_name}`, body));
},
);
server.tool(
'gitea_wiki_page_delete',
'Delete a wiki page',
{
...OwnerRepo,
page_name: z.string().describe('Page name/slug to delete'),
...ConnectionParam,
},
async ({ owner, repo, page_name, connection }) =>
formatResponse(await clientFor(connection).delete(`/repos/${owner}/${repo}/wiki/page/${page_name}`)),
);
// ── Notifications ───────────────────────────────────────────────────────
server.tool(