Documentation
¶
Overview ¶
Package wiki provides MCP tools for managing Forgejo wiki pages.
It includes tools for listing, retrieving, creating, editing, and deleting wiki pages. These functionalities extend beyond the official Forgejo SDK.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateWikiPageImpl ¶
CreateWikiPageImpl implements the MCP tool for creating a new wiki page. This is a non-idempotent operation that adds a new page to the repository's wiki. Note: This feature is not supported by the official Forgejo SDK and requires a custom HTTP implementation.
func (CreateWikiPageImpl) Definition ¶
func (CreateWikiPageImpl) Definition() *mcp.Tool
Definition describes the `create_wiki_page` tool. It requires `owner`, `repo`, `title`, and `content`. It is not idempotent as multiple calls with the same parameters will result in multiple pages if the title is not unique.
func (CreateWikiPageImpl) Handler ¶
func (impl CreateWikiPageImpl) Handler() mcp.ToolHandlerFor[CreateWikiPageParams, any]
Handler implements the logic for creating a wiki page. It performs a custom HTTP POST request to the `/repos/{owner}/{repo}/wiki/new` endpoint. On success, it returns information about the newly created page.
type CreateWikiPageParams ¶
type CreateWikiPageParams struct {
// Owner is the username or organization name that owns the repository.
Owner string `json:"owner"`
// Repo is the name of the repository.
Repo string `json:"repo"`
// Title is the title for the new wiki page.
Title string `json:"title"`
// Content is the markdown content of the new wiki page.
Content string `json:"content"`
// Message is an optional commit message for the creation.
Message string `json:"message,omitempty"`
}
CreateWikiPageParams defines the parameters for the create_wiki_page tool. It includes the title and content for the new wiki page.
type DeleteWikiPageImpl ¶
DeleteWikiPageImpl implements the destructive MCP tool for deleting a wiki page. This is an idempotent but irreversible operation. Note: This feature is not supported by the official Forgejo SDK and requires a custom HTTP implementation.
func (DeleteWikiPageImpl) Definition ¶
func (DeleteWikiPageImpl) Definition() *mcp.Tool
Definition describes the `delete_wiki_page` tool. It requires `owner`, `repo`, and `page_name`. It is marked as a destructive operation to ensure clients can warn the user before execution.
func (DeleteWikiPageImpl) Handler ¶
func (impl DeleteWikiPageImpl) Handler() mcp.ToolHandlerFor[DeleteWikiPageParams, any]
Handler implements the logic for deleting a wiki page. It performs a custom HTTP DELETE request to the `/repos/{owner}/{repo}/wiki/page/{pageName}` endpoint. On success, it returns a simple text confirmation.
type DeleteWikiPageParams ¶
type DeleteWikiPageParams struct {
// Owner is the username or organization name that owns the repository.
Owner string `json:"owner"`
// Repo is the name of the repository.
Repo string `json:"repo"`
// PageName is the title of the wiki page to delete.
PageName string `json:"page_name"`
}
DeleteWikiPageParams defines the parameters for the delete_wiki_page tool. It specifies the page to be deleted.
type EditWikiPageImpl ¶
EditWikiPageImpl implements the MCP tool for editing an existing wiki page. This is an idempotent operation. Note: This feature is not supported by the official Forgejo SDK and requires a custom HTTP implementation.
func (EditWikiPageImpl) Definition ¶
func (EditWikiPageImpl) Definition() *mcp.Tool
Definition describes the `edit_wiki_page` tool. It requires `owner`, `repo`, `page_name`, and new `content`. It is marked as idempotent.
func (EditWikiPageImpl) Handler ¶
func (impl EditWikiPageImpl) Handler() mcp.ToolHandlerFor[EditWikiPageParams, any]
Handler implements the logic for editing a wiki page. It performs a custom HTTP PATCH request to the `/repos/{owner}/{repo}/wiki/page/{pageName}` endpoint. It returns an error if the page is not found.
type EditWikiPageParams ¶
type EditWikiPageParams struct {
// Owner is the username or organization name that owns the repository.
Owner string `json:"owner"`
// Repo is the name of the repository.
Repo string `json:"repo"`
// PageName is the current title of the wiki page to edit.
PageName string `json:"page_name"`
// Title is the optional new title for the wiki page.
Title string `json:"title,omitempty"`
// Content is the new markdown content for the wiki page.
Content string `json:"content"`
// Message is an optional commit message for the update.
Message string `json:"message,omitempty"`
}
EditWikiPageParams defines the parameters for the edit_wiki_page tool. It specifies the page to edit and the new content.
type GetWikiPageImpl ¶
GetWikiPageImpl implements the read-only MCP tool for fetching a single wiki page. This operation is safe, idempotent, and does not modify any data. Note: This feature is not supported by the official Forgejo SDK and requires a custom HTTP implementation.
func (GetWikiPageImpl) Definition ¶
func (GetWikiPageImpl) Definition() *mcp.Tool
Definition describes the `get_wiki_page` tool. It requires `owner`, `repo`, and `page_name` as parameters and is marked as a safe, read-only operation.
func (GetWikiPageImpl) Handler ¶
func (impl GetWikiPageImpl) Handler() mcp.ToolHandlerFor[GetWikiPageParams, any]
Handler implements the logic for fetching a wiki page. It performs a custom HTTP GET request to the `/repos/{owner}/{repo}/wiki/page/{pageName}` endpoint and formats the resulting page content as markdown. Errors will occur if the page or repository is not found.
type GetWikiPageParams ¶
type GetWikiPageParams struct {
// Owner is the username or organization name that owns the repository.
Owner string `json:"owner"`
// Repo is the name of the repository.
Repo string `json:"repo"`
// PageName is the title of the wiki page to retrieve.
PageName string `json:"page_name"`
}
GetWikiPageParams defines the parameters for the get_wiki_page tool. It specifies the owner, repository, and page name to retrieve.
type ListWikiPagesImpl ¶
ListWikiPagesImpl implements the read-only MCP tool for listing repository wiki pages. This operation is safe, idempotent, and does not modify any data. It fetches all available wiki pages for a specified repository. Note: This feature is not supported by the official Forgejo SDK and requires a custom HTTP implementation.
func (ListWikiPagesImpl) Definition ¶
func (ListWikiPagesImpl) Definition() *mcp.Tool
Definition describes the `list_wiki_pages` tool. It requires `owner` and `repo` as parameters and is marked as a safe, read-only operation.
func (ListWikiPagesImpl) Handler ¶
func (impl ListWikiPagesImpl) Handler() mcp.ToolHandlerFor[ListWikiPagesParams, any]
Handler implements the logic for listing wiki pages. It performs a custom HTTP GET request to the `/repos/{owner}/{repo}/wiki/pages` endpoint and formats the resulting list of pages into a markdown table. Errors will occur if the repository is not found or authentication fails.
type ListWikiPagesParams ¶
type ListWikiPagesParams struct {
// Owner is the username or organization name that owns the repository.
Owner string `json:"owner"`
// Repo is the name of the repository.
Repo string `json:"repo"`
}
ListWikiPagesParams defines the parameters for the list_wiki_pages tool. It specifies the owner and repository name to list wiki pages from.