server_types.go

  1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
  2//
  3// SPDX-License-Identifier: LicenseRef-MutuaL-1.2
  4
  5package mcp
  6
  7import "git.secluded.site/cooked-mcp/internal/cooked"
  8
  9// ReadArguments contains read tool arguments.
 10type ReadArguments struct {
 11	Target   string `json:"target"              jsonschema:"Cooked object to read. Use shopping_list, recipes, recipe, or example_recipes."`
 12	RecipeID string `json:"recipe_id,omitempty" jsonschema:"Recipe ID for target recipe."`
 13	Query    string `json:"query,omitempty"     jsonschema:"Search query for target recipes. Omit to list saved recipes."`
 14	Page     int    `json:"page,omitempty"      jsonschema:"Page number for target recipes. Defaults to 1."`
 15	Limit    int    `json:"limit,omitempty"     jsonschema:"Maximum recipe cards for target recipes. Defaults to 10 and caps at 30."`
 16}
 17
 18// ReadOutput is the structured output for the current read tool slice.
 19type ReadOutput struct {
 20	Aisles              []cooked.Aisle  `json:"aisles,omitempty"`
 21	ShoppingListRecipes []string        `json:"shopping_list_recipes,omitempty"`
 22	Recipes             []RecipeSummary `json:"recipes,omitempty"`
 23	Recipe              *RecipeDetail   `json:"recipe,omitempty"`
 24	ExampleRecipes      string          `json:"example_recipes,omitempty"`
 25}
 26
 27// RecipeSummary is the MCP-safe saved recipe summary.
 28type RecipeSummary struct {
 29	ID    string `json:"id"`
 30	Title string `json:"title"`
 31}
 32
 33// RecipeDetail is the MCP-safe single recipe output.
 34type RecipeDetail struct {
 35	ID       string  `json:"id"`
 36	Title    string  `json:"title"`
 37	Owner    string  `json:"owner"`
 38	Content  string  `json:"content"`
 39	Portions float64 `json:"portions"`
 40}
 41
 42// ExtractIntoRecipeArguments contains extract_into_recipe tool arguments.
 43type ExtractIntoRecipeArguments struct {
 44	Title string `json:"title" jsonschema:"Recipe title for the extraction."`
 45	Text  string `json:"text"  jsonschema:"Raw recipe text to extract into Cooked recipe markdown without saving."`
 46}
 47
 48// ExtractIntoRecipeOutput is the structured output for extract_into_recipe.
 49type ExtractIntoRecipeOutput struct {
 50	Title    string  `json:"title"`
 51	Markdown string  `json:"markdown"`
 52	Portions float64 `json:"portions"`
 53}
 54
 55// SaveRecipeArguments contains save_recipe tool arguments.
 56type SaveRecipeArguments struct {
 57	Source   string  `json:"source"              jsonschema:"Recipe save source: raw_text, prepared, url, draft, or existing."`
 58	RecipeID string  `json:"recipe_id,omitempty" jsonschema:"Recipe ID for source=existing updates or source=draft overwrite into an existing recipe."`
 59	DraftID  string  `json:"draft_id,omitempty"  jsonschema:"Draft ID for reviewed URL import draft saves."`
 60	Title    string  `json:"title,omitempty"     jsonschema:"Recipe title for raw_text or prepared saves."`
 61	Text     string  `json:"text,omitempty"      jsonschema:"Raw recipe text for raw_text saves."`
 62	URL      string  `json:"url,omitempty"       jsonschema:"Recipe URL for url imports."`
 63	Markdown string  `json:"markdown,omitempty"  jsonschema:"Recipe markdown for prepared saves, optional reviewed URL import draft content, or existing recipe updates. Read target example_recipes first for Cooked's markdown dialect and examples."`
 64	Portions float64 `json:"portions,omitempty"  jsonschema:"Recipe portions for prepared saves or existing recipe updates; defaults to 1 when omitted. For reviewed draft content, provide portions together with markdown."`
 65}
 66
 67// SaveRecipeOutput is the structured output for save_recipe.
 68type SaveRecipeOutput struct {
 69	RecipeID string  `json:"recipe_id,omitempty"`
 70	DraftID  string  `json:"draft_id,omitempty"`
 71	Title    string  `json:"title,omitempty"`
 72	Markdown string  `json:"markdown,omitempty"`
 73	Portions float64 `json:"portions,omitempty"`
 74}
 75
 76// DeleteRecipeArguments contains delete_recipe tool arguments.
 77type DeleteRecipeArguments struct {
 78	RecipeID string `json:"recipe_id" jsonschema:"Recipe ID to delete."`
 79}
 80
 81// DeleteRecipeOutput is the structured output for delete_recipe.
 82type DeleteRecipeOutput struct {
 83	RecipeID string `json:"recipe_id"`
 84}
 85
 86// ChangeShoppingListArguments contains change_shopping_list tool arguments.
 87type ChangeShoppingListArguments struct {
 88	Action          string          `json:"action"                      jsonschema:"Shopping-list action: add, remove, replace_selection, add_selection, remove_selection, update_item, or clear."`
 89	Ingredients     string          `json:"ingredients,omitempty"       jsonschema:"Newline-separated ingredients for action add. Put quantities before names, for example 1 milk."`
 90	RecipeID        string          `json:"recipe_id,omitempty"         jsonschema:"Optional saved recipe ID or import draft ID for action add."`
 91	ProductGroupIDs ProductGroupIDs `json:"product_group_ids,omitempty" jsonschema:"Product group IDs for action remove, replace_selection, add_selection, or remove_selection."`
 92	ProductGroupID  string          `json:"product_group_id,omitempty"  jsonschema:"Product group ID for action update_item."`
 93	Name            *string         `json:"name,omitempty"              jsonschema:"Replacement product name for action update_item."`
 94	Quantity        *string         `json:"quantity,omitempty"          jsonschema:"Replacement quantity for action update_item."`
 95	AisleID         *string         `json:"aisle_id,omitempty"          jsonschema:"Replacement aisle ID for action update_item."`
 96	Selected        *bool           `json:"selected,omitempty"          jsonschema:"Replacement selected state for action update_item."`
 97}
 98
 99// ProductGroupIDs are Cooked shopping-list product group IDs used by bulk actions.
100type ProductGroupIDs []string
101
102// ChangeShoppingListOutput is the structured output for change_shopping_list.
103type ChangeShoppingListOutput struct {
104	Cleared                 bool     `json:"cleared,omitempty"`
105	AddedCount              int      `json:"added_count,omitempty"`
106	Ingredients             []string `json:"ingredients,omitempty"`
107	RemovedProductGroupIDs  []string `json:"removed_product_group_ids,omitempty"`
108	SelectedProductGroupIDs []string `json:"selected_product_group_ids,omitempty"`
109	UpdatedProductGroupID   string   `json:"updated_product_group_id,omitempty"`
110	SkippedProductGroupIDs  []string `json:"skipped_product_group_ids,omitempty"`
111}