sevenpace

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sevenpace integrates 7pace Timetracker (an Appfire product) for Azure DevOps via its Reporting OData API (e.g. https://{org}.timehub.7pace.com/api/odata/v3.2), authenticated with a bearer token. It exposes worklog and work-item reporting queries as MCP tools.

The OData Reporting API is read-only and requires a Service Account to be configured in 7pace Timetracker settings; without it the API returns HTTP 403 "ServiceAccountNotSet". The base URL comes from configuration (config.SevenPaceBaseURL), which honors the SEVENPACE_API_BASE override.

Creating a worklog (CreateWorkLog) uses a second, separate base URL (config.SevenPaceRestBaseURL, SEVENPACE_REST_BASE) since 7pace's write capability lives on its main REST API, not the read-only Reporting OData API above. That REST base/endpoint shape is a best-effort default, not verified against a live 7pace account — see CreateWorkLog's doc comment.

Index

Constants

View Source
const Name = "sevenpace"

Name is the toolset name used for enable/disable filtering.

Variables

This section is empty.

Functions

func Register

func Register(s *server.Server, c *Client)

Register adds the 7pace Timetracker toolset. Most tools read the 7pace Reporting OData API (read-only, and requires a Service Account configured in 7pace settings); sevenpace_create_worklog is the one write tool, using a separate, best-effort REST API integration (see the package doc).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the REST clients for the 7pace OData (read) and REST (write) APIs.

func NewClient

func NewClient(odataBaseURL, restBaseURL, token string, opts ...client.Option) (*Client, error)

NewClient builds a 7pace client for the given OData (read) and REST (write) API base URLs and bearer token.

func (*Client) CreateWorkLog added in v0.1.2

func (c *Client) CreateWorkLog(ctx context.Context, timestamp time.Time, lengthSeconds int, comment string, workItemID int) (Record, error)

CreateWorkLog creates a new worklog entry via the write-capable REST API (a different base URL from every other method on Client, which use the read-only OData Reporting API — see the package doc comment). workItemID optionally links the worklog to an Azure DevOps work item; zero means unlinked (some 7pace configurations require one, in which case this call fails without it).

This endpoint path and request/response shape are a best-effort guess (POST {SevenPaceRestBaseURL}/workLogs with a timestamp/length/comment/ workItemId body), not verified against a live 7pace account. If it fails, check SEVENPACE_REST_BASE and the returned error body against 7pace's actual REST API documentation for your account's version.

func (*Client) ListBudgets

func (c *Client) ListBudgets(ctx context.Context, top int) ([]Record, error)

ListBudgets returns the configured budgets.

func (*Client) ListWorkItems

func (c *Client) ListWorkItems(ctx context.Context, filter string, top int) ([]Record, error)

ListWorkItems returns work items with rolled-up tracked time.

func (*Client) ListWorkLogs

func (c *Client) ListWorkLogs(ctx context.Context, filter string, top int) ([]Record, error)

ListWorkLogs returns worklog records (the workLogsOnly entity set), optionally filtered by an OData $filter (e.g. "Timestamp ge 2026-01-01T00:00:00Z").

func (*Client) ListWorkLogsWithWorkItems

func (c *Client) ListWorkLogsWithWorkItems(ctx context.Context, filter string, top int) ([]Record, error)

ListWorkLogsWithWorkItems returns worklogs joined with their work items (the workLogsWorkItems entity set).

func (*Client) QueryRaw

func (c *Client) QueryRaw(ctx context.Context, path string, opts url.Values) (string, error)

QueryRaw performs a GET against an arbitrary OData path (e.g. an entity set or "$metadata") with raw query options, returning the response body verbatim. It is the escape hatch for entity sets or options not covered by the typed methods and for schema discovery.

type CreateWorkLogInput added in v0.1.2

type CreateWorkLogInput struct {
	Timestamp     string `json:"timestamp" jsonschema:"when the tracked time started, RFC3339 (e.g. 2026-01-01T09:00:00Z)"`
	LengthSeconds int    `json:"lengthSeconds" jsonschema:"duration of the worklog, in seconds"`
	Comment       string `json:"comment,omitempty" jsonschema:"worklog description/note text (optional)"`
	WorkItemID    int    `json:"workItemId,omitempty" jsonschema:"linked Azure DevOps work item ID (optional; some 7pace configurations require one)"`
}

CreateWorkLogInput describes a new 7pace worklog entry.

type FilterInput

type FilterInput struct {
	Filter string `json:"filter,omitempty" jsonschema:"optional OData $filter expression"`
	Top    int    `json:"top,omitempty" jsonschema:"maximum number of records to return (optional)"`
}

FilterInput filters and pages an OData entity set.

type QueryInput

type QueryInput struct {
	Path    string `json:"path" jsonschema:"OData path, e.g. workLogsOnly, workItems, or $metadata"`
	Filter  string `json:"filter,omitempty" jsonschema:"optional OData $filter expression"`
	Select  string `json:"select,omitempty" jsonschema:"optional OData $select (comma-separated fields)"`
	OrderBy string `json:"orderby,omitempty" jsonschema:"optional OData $orderby expression"`
	Top     int    `json:"top,omitempty" jsonschema:"optional OData $top"`
}

QueryInput is a raw OData request.

type QueryOutput

type QueryOutput struct {
	Body string `json:"body" jsonschema:"the raw response body"`
}

QueryOutput wraps a raw OData response body.

type Record

type Record = map[string]any

Record is a single OData entity returned by the Reporting API. Field names vary by entity (e.g. Timestamp, Length, User, ActivityType for worklogs), so records are returned untyped rather than forcing a fixed schema.

type TopInput

type TopInput struct {
	Top int `json:"top,omitempty" jsonschema:"maximum number of records to return (optional)"`
}

TopInput pages an OData entity set.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL